===== bash: "How To" ... utilize tests ===== ^operation^what^code^ |string|variable equal to "__xyz__"|if [ $STR == "__xyz__" ]| |:::|variable unequal to "__xyz__"|if [ $STR != "__xyz__" ]| |:::|variable contains substring "__xyz__"|if %%[[%% $STR =~ "__xyz__" %%]]%%| |:::|variable is in list "__abc__" or "__def__" (or ...)|if %%[[%% $STR =~ %%^%%("__abc__"%%|%%"__def__")$ %%]]%%| |integer|variable equal to __n__|if [ $STR -eq __n__ ]| |file|"__node__" exists \\ (whatever type i.e. file, folder, ...)|if [ -e "__node__" ]| |:::|regular "__filename__" exists|if [ -f "__filename__" ]| |:::|create unique temporary file|touch /tmp/$$.tmp| |:::|find file "__filename__" with numerically \\ largest extension in folder|ls -1d "__filename__.*" %%|%% cut -d "." -f 2 %%|%% sort -rg %%>%% /tmp/$$.tmp \\ MAX=$(head -n 1 /tmp/$$.tmp)| |execution|result of command execution|RSLT=$?| |:::|being root|if ($(id -u) -eq 0))| //work in progress//