我需要使用sed或awk替换文件中的cron条目。
试过这个:没起作用
sed -i 's/0 0 * * 0/0 1 * * 1/g' script.shscript.sh
#!/bin/bash
mkdir -p .github/workflows
cd .github/workflows
touch semgrep.yml
cat << EOF > semgrep.yml
name: Semgrep
on:
pull_request: {}
push:
branches:
- master
- main
paths:
- .github/workflows/semgrep.yml
schedule:
- cron: '0 0 * * 0'
jobs:
semgrep:
name: Static Analysis Scan
runs-on: ubuntu-18-04请帮我同样的忙。
发布于 2022-06-07 15:48:25
使用mikefarah/yq编辑文件就位(-i):
yq -i '.on.schedule[].cron = "0 1 * * 1"' semgrep.yml将打开包含以下内容的semgrep.yml
name: Semgrep
on:
pull_request: {}
push:
branches:
- master
- main
paths:
- .github/workflows/semgrep.yml
schedule:
- cron: '0 0 * * 0'
jobs:
semgrep:
name: Static Analysis Scan
runs-on: ubuntu-18-04变成一个包含
name: Semgrep
on:
pull_request: {}
push:
branches:
- master
- main
paths:
- .github/workflows/semgrep.yml
schedule:
- cron: '0 1 * * 1'
jobs:
semgrep:
name: Static Analysis Scan
runs-on: ubuntu-18-04https://stackoverflow.com/questions/72530054
复制相似问题