in reply to External Dependencies on Unix Commands
You are correct about "which" only working within your path. However, for most of these, that would be a safe assumption. sqlplus and gtar are more problematic, as they may not be installed on your target system at all, or might be found other places (like /usr/local/bin). The only sure way to know is to check for yourself before-hand (assuming shell access) or ask your sys admin. Shell could be any number of varieties from Bourne to Korn to Bash to POSIX to...so YMMV regarding aliases and built-ins. Again, your sys admin is the definitive source.
awk might be one of the most troublesome as there are significant differences in versions and it is not uncommon to have multiple versions on the same system (awk, gawk, nawk...). One of our systems had both awk and nawk and each was referenced by a symlink named awk at different places. Made for real interesting behavior if you had a dot in your path!
I second the notion of using a pure perl solutions where possible. Do you need echo when you have print, printf, and formats? Do you need grep when you have, arguably, more powerful regex capabilities within Perl? Most(all?) of what you listed has a pure Perl counterpart.
You might also want to take a look at Heiner's SHELLdorado. It is an excellent refernece for shell tools that includes info and or links covering awk version compatibility and cross-platform shell scripting.
|
---|