3 ms·
When writing a shell script the robustness/reliabilty can be inferred from it's scope: 1. Uses shell-only commands (echo, for) - most robust; but things like b
by 0xff00ffee 7y ago
When writing a shell script the robustness/reliabilty can be inferred from it's scope:
1. Uses shell-only commands (echo, for) - most robust; but things like basename/dirname and regex's vary by shell (sh, bash, zsh, ksh)
2. Uses /bin - might run into missing a binary but not likely, still robust and allows a richer set of tools (e.g., uname, chmod and admin-ish things live in /bin)
3. Uses /usr/bin - runs risk if missing packages, likely not very robust (packages drop things in here, like gzip, yacc, gcc)
4. Uses /usr/local/bin or /opt/local/bin - definitely requires package installs, least robust