Category: Bash
-
GNU bash exit codes with special meanings
$printenv > /dev/null $echo $? 0 $printenv /dev/null $echo $? 1 $/dev/null bash: /dev/null: Permission denied $echo $? 126 $nocommand bash: nocommand: command not found… $ $echo $? 127 $ http://www.tldp.org/LDP/abs/html/exitcodes.html
-
Basic tinkering with “set” command and “noclobber” related
commandline session [bash light=”true”] $echo improve > clean.txt $cat clean.txt improve $set -o noclobber $echo new > clean.txt bash: clean.txt: cannot overwrite existing file $echo new >> clean.txt $cat clean.txt improve new $echo again >| clean.txt $cat clean.txt again $set +o noclobber $echo improve > clean.txt $cat clean.txt improve $ [/bash]
-
number of processing units.
$nproc 1 $nproc –all 1 $ nproc Print the number of processing units available to the current process, which may be less than the number of online processors