|
|
Similar Korn and Bourne tricks of the trade
Ugh, hard-coding pathnames in commands is a different kind of evil; consider an 'rm' upgraded to handle meta-info on some weird filesystem that isn't supported by the standard /bin or /usr/bin commands. There's no reliable way to presume the 'rm' you want is in /bin or /usr/bin or /usr/xpg4/bin or whatever, if cross-UNIX portability matters.
I don't use C Shell, but the Korn (POSIX) shell has a "command" keyword, so you can definately get the actual command by regular path search, no alias, no function. (I think Bourne shells have it too.)
The other change I'd recommend in Korn (POSIX) and Bourne scripts is to use (or ; that turns on "privileged" mode, intended for set-user-ID scripts, but it also prvents the shell from loading the user's ~/.*rc files, so no surprising functions or aliases.
And don't forget , to exit automatically on a failed command that doesn't have error checking associated with it. Scripts that ignore errors are evil.
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.14 seconds |
|