This shows you the differences between two versions of the page.
|
bash:how_to:tests [2018/08/03 05:58] Rob Stroess |
bash:how_to:tests [2024/02/16 01:04] (current) |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| |:::|variable is in list "__abc__" or "__def__" (or ...)|if %%[[%% $STR =~ %%^%%("__abc__"%%|%%"__def__")$ %%]]%%| | |:::|variable is in list "__abc__" or "__def__" (or ...)|if %%[[%% $STR =~ %%^%%("__abc__"%%|%%"__def__")$ %%]]%%| | ||
| |integer|variable equal to __n__|if [ $STR -eq __n__ ]| | |integer|variable equal to __n__|if [ $STR -eq __n__ ]| | ||
| - | |file|__filename__ exists|if [ -e "__filename__" ]| | + | |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| | |:::|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)| | |:::|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)| | ||
| Line 12: | Line 13: | ||
| |:::|being root|if ($(id -u) -eq 0))| | |:::|being root|if ($(id -u) -eq 0))| | ||
| + | //work in progress// | ||