How to input a path with a white space?
Use one of these threee variants: SOME_PATH=”/mnt/someProject/some path” SOME_PATH=’/mnt/someProject/some path’ SOME_PATH=/mnt/someProject/some\ path
Use one of these threee variants: SOME_PATH=”/mnt/someProject/some path” SOME_PATH=’/mnt/someProject/some path’ SOME_PATH=/mnt/someProject/some\ path
If you’re talking about an up-to-date timestamp on each line, that’s something you’d probably want to do in your actual script (but see below for a nifty solution if you have no power to change it). If you just want a marker date on its own line before your script starts writing, I’d use: ( … Read more
Use -F [field separator] to split the lines on “s: awk -F ‘”‘ ‘{print $2}’ your_input_file or for input from pipe <some_command> | awk -F ‘”‘ ‘{print $2}’ output: A B C D
source your script, don’t execute it like ./foo.sh or sh foo.sh If you execute your script like that, it is running in sub-shell, not your current. source foo.sh would work for you.
Perhaps a little surprisingly, paste is a good way to do this: paste -s -d”,” This won’t deal with the empty lines you mentioned. For that, pipe your text through grep, first: grep -v ‘^$’ | paste -s -d”,” –
In bash you can use set -e and set -o pipefail at the beginning of your file. A subsequent command ./a | ./b | ./c will fail when any of the three scripts fails. The return code will be the return code of the first failed script. Note that pipefail isn’t available in standard sh.
For the cut(1) man page: Use one, and only one of -b, -c or -f. Each LIST is made up of one range, or many ranges separated by commas. Selected input is written in the same order that it is read, and is written exactly once. It reaches field 1 first, so that is printed, … Read more
To download release file from private repo, you can use Personal access token which can be generated at settings/tokens with Full control of private repositories scope. Then download the asset with curl command (change with appropriate values): curl -vLJO -H ‘Authorization: token my_access_token’ ‘https://api.github.com/repos/:owner/:repo/releases/assets/:id’ or if you’re using an OAuth app, use: curl -u my_client_id:my_client_secret … Read more
Modern Jenkins versions (since 2.26, October 2016) solved this: it’s just an advanced option for the Execute shell build step! You can just choose and set an arbitrary exit value; if it matches, the build will be unstable. Just pick a value which is unlikely to be launched by a real process in your build.
An example to help you get off the ground. for f in *.jpg; do mv “$f” “$(echo “$f” | sed s/IMG/VACATION/)”; done In this example, I am assuming that all your image files contain the string IMG and you want to replace IMG with VACATION. The shell automatically evaluates *.jpg to all the matching files. … Read more