Why would any expression in a bash script be ORed with true
?
iw dev interface del || true
The command probably occurs in the context of a script using set -e
, which will cause the script to exit if any command has a non-zero exit status. If you run iw dev interface del
and it fails, the script will exit. If you run iw dev interface del || true
, though, even if iw
fails, then true
will run and it is guaranteed to succeed, meaning the exit status of the full command is zero.
Essentially, <command> || true
is an idiom that means "Run <command> but ignore its exit status".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With