[2017-12-25] boolean return value [2017-12-26] multi-line string varible [2017-12-30] iterate over array [2018-04-26] get current script directory #!/bin/bash -eu)](#vdpssngflgsnshbnggbnbsh TIDDLYLINK) [[habit]][2015-07-23] diff <(ls dir1) <(ls dir2) find . -exec some command {} \;](#xccmmndnchflfndxcsmcmmnd TIDDLYLINK) [[drill]]find /path -iname '*.pdf' -print0 | xargs -0 -n1 -i -P8 bash -c "echo 'Processing {}' && command '{}'"](#xccmmndnprlllfndpthnmpdfptxrgsnpbshcchprcssngcmmnd TIDDLYLINK) [[drill]][2018-05-08] ps aufx to list all processes cat file.json | python -mjson.tool](#prttyprntjsnctfljsnpythnmjsntl TIDDLYLINK) [[json]]ldconfig -p | grep libjpeg or gcc -ljpeg](#dtctflbrrysnstlldldcnfgpgrplbjpgrgccljpg TIDDLYLINK) [2015-07-23] merging pdfs [2021-01-06] Where is the bash feature to open a command in $EDITOR documented? - Unix & Linux Stack Exchange [[bash]] [[habit]]Bash & shell programming
[2017-12-25] boolean return valuefunction whatever {
if (x)
then
true
else
false
fi
}
if whatever
then ...
[2017-12-26] multi-line string varibleMULTILINE=$(cat <<-END
here
goes
multi
line
END
)
[2017-12-30] iterate over arrayEXTRA_STOWS=("home-arbtt" "home-emacs" "home-anacron")
for s in "${EXTRA_STOWS[@]}"
[2018-04-26] get current script directoryDIR=$(dirname "$(readlink -f "$0")")
(might not work on mac)
#!/bin/bash -eu) [[habit]]e.g. if you specify other flags in terminal, they would override everything
instead, better to use if [[ $0 == "$BASH_SOURCE" ]]; then set -eux; fi
priorities roughly indicate how useful I find each command
[2015-07-23] diff <(ls dir1) <(ls dir2)find . -exec some command {} \; [[drill]]find /path -iname '*.pdf' -print0 | xargs -0 -n1 -i -P8 bash -c "echo 'Processing {}' && command '{}'" [[drill]][2018-05-08] ps aufx to list all processescat file.json | python -mjson.tool [[json]]ldconfig -p | grep libjpeg or gcc -ljpeg[2015-07-23] merging pdfspdftk out.pdf j1-process.pdf j1-process-2.pdf j1-process-3.pdf cat output merged.pdf
pdftk full-pdf.pdf cat 1 1 1 2 3 4 12-15 output outfile_p12-15.pdf
[2021-01-06] Where is the bash feature to open a command in $EDITOR documented? - Unix & Linux Stack Exchange [[bash]] [[habit]]edit-and-execute-command (C-xC-e)