Shell Script 3 Finger Claw⚓︎
What is the 3 Finger Claw⚓︎
The 3 Finger Claw for Unix and Linux shells is a quick and easy way to add error checking to shell scripts. They have been tested heavily by others to be as compatible as possible with all shells and POSIX.
There are many uses, but as an example they give cd /missing/path
. Most systems will not have this path, but if the script assumes the directory exists from this command on the current directory is incorrect. Could this cause your script to perform actions in the wrong directory?
By wrapping the cd in the 3 finger claw your script is protected from doing actions you didn’t want as it will exit when you try cd /missing/path
Code⚓︎
Bash | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|