Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: External Dependencies on Unix Commands

by rah (Monk)
on Jun 08, 2002 at 03:43 UTC ( [id://172738]=note: print w/replies, xml ) Need Help??

in reply to External Dependencies on Unix Commands

The location, availability, and versions of some of these tools is precisely why cross-platform shell scripting is so tricky. Also, as perigeeV observes, a big factor in the emergence of Perl as a cross OS tool. Most of the tools you describe are standard UNIX commands and are likely to be found in /bin or /usr/bin. Both should be in your path with a standard shell login on most UNIX systems. echo is likely to be found as a shell built-in.

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 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.

  • Comment on Re: External Dependencies on Unix Commands

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://172738]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-05-30 12:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found