Shell Scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 8 Nov 2003, Luke Davis wrote:

> Oh, something else you have to know about scripts, is that they have to
> either be in a bin directory (such as /usr/local/sbin, or /root/bin (if
> that is in your path)), or you must specify the path, even if it is in the
> current directory (for example: "./my script").

Really?  Never heard that in my life.  It doesn't matter what the
directory is as long as it's in your path.  If you have the current
directory in your path, then the script can be called with just its name
even if it's in the current directory.  Second, you might not always want
700 permissions on a script.  That would let only the user who owns the
script run it.  This is OK, and even a good idea for a backup script run
by root, but if it needs to be run by others, it should have execute
permission at least for group and possibly world.  Almost all the programs
that are on a system, be they scripts or compiled, have world execute on
so that any user can run them.  Otherwise, you couldn't use ls, cp, cat,
etc.  The last thing is that scripts run from cron may want to explicitly
set the path to something appropriate, or use full pathnames for
everything.  I found out the hard way that Slackware 9.1 dropped
/usr/local/sbin from the default path for cron jobs.  That's why I have
the remark about it and use the full path to dump in my backup script I
posted.  /bin and /usr/bin are apparently still there, as the rest of the
commands work fine.






[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux