3
votes
Bash/Dash - Catching the error when calling set
set is a special built-in, and per POSIX, errors in special built-ins shall cause an interactive shell to exit. But you can use command to "de-specialize" it. (this is straight up mentioned ...
2
votes
Bash/Dash - Catching the error when calling set
In the end I had to run a sub-shell just to check whether set -o pipefail will work.
# Workaround for Dash and other shells that do not support -o pipefail.
if (set -o pipefail 2>/dev/null); then
...
1
vote
Accepted
Cancel just second command of bash logical AND operator
Just do Ctrl+z upon which fg will return with an exit code of 128+SIGTSTP, so not 0/success, so shutdown won't be run, and then fg again without a && shutdown this time.
Example:
bash-5.3$ ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
bash × 28055shell-script × 6993
shell × 4214
linux × 2880
scripting × 1579
awk × 1021
command-line × 991
sed × 975
terminal × 820
grep × 730
text-processing × 725
ssh × 716
find × 683
variable × 648
ubuntu × 597
io-redirection × 595
zsh × 584
pipe × 575
environment-variables × 545
files × 542
alias × 516
quoting × 508
command-history × 463
wildcards × 461
regular-expression × 447