GNU bash: Difference between revisions
Jump to navigation
Jump to search
m Add references category |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
== Safe bash == | |||
{| class="wikitable" | |||
!Command | |||
!Comments | |||
|- | |||
|set -o pipefail | |||
|returns error if the pipe fails | |||
|- | |||
|set -e | |||
|exit on the first program fail | |||
|} | |||
== test or [ <ref>http://tldp.org/LDP/abs/html/fto.html</ref><ref>http://tldp.org/LDP/abs/html/comparison-ops.html</ref> == | == test or [ <ref>http://tldp.org/LDP/abs/html/fto.html</ref><ref>http://tldp.org/LDP/abs/html/comparison-ops.html</ref> == | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 6: | Line 18: | ||
| -d ''file'' | | -d ''file'' | ||
|''file'' is a directory | |''file'' is a directory | ||
|- | |||
| -n ''string'' | |||
|the length of ''string'' is nonzero | |||
|- | |- | ||
|''string1'' != ''string2'' | |''string1'' != ''string2'' | ||