change drive

James Wilkinson ubuntu at westexe.demon.co.uk
Thu Apr 21 16:49:51 UTC 2005


ZIYAD A. M. AL-BATLY wrote about putting changes in .bashrc and
.profile.

Matthew S-H asked:
> But will this also apply to scripts invoked from Nautilus?

You know, there's a great deal to be said for setting stuff like PATH
explicitly in the script itself.

If you want a script to be robust, try not to assume too much about the
system you're running on. If a command might not be there, do a
COMMAND=$(which command)
[ -x "$COMMAND" ] || exit
$COMMAND

Sooner or later, the chances are you'll want to run that script on
another system.

And, while I think about it, consider using
cd $NEWDIR || exit
in scripts, not just plain cd.

Otherwise, a script with
cd /home
prog1
cd /tmp/tmpdir
rm -rf *

could turn a system with broken permissions on /tmp into a catastrophe.

Not particularly relevant to the original question, I suppose...

James.

-- 
E-mail address: james | ... lest untrained handling cause the collapse of
@westexe.demon.co.uk  | everything that it is possible to imagine. *
                      |     *  Again.
                      |     -- Going Postal, Terry Pratchett.




More information about the ubuntu-users mailing list