macos script

Glenn Satchell Glenn.Satchell at uniq.com.au
Tue Nov 3 23:33:42 UTC 2009


When I write a script, as the author I know what commands are going
tobe run, so it makes sense to set the PATH to all the directories that
are required. I don't know what the PATH in your shell is going to be,
so I can't assume that it will find all the commands.

Best practise suggests I should set the PATH to the full list of
required directories - that's just going to be less hassle for
everyone later on.

regards,
-glenn
 
>From: hobbes <hobbes444 at gmail.com>
>Date: Tue, 3 Nov 2009 17:30:43 +0100
>
>So you want me to add "/sbin" to my PATH variable from within the script?
>
>PATH=/sbin/:$PATH
>
>for example?
>
>
>On Tue, Nov 3, 2009 at 17:10, Simon Hobson <dhcp1 at thehobsons.co.uk> wrote:
>> hobbes wrote:
>>>
>>> Well, my PATH variable in bash in correct.
>>
>> When/how did you check that - by typing "echo $PATH" in a shell ? It's a
>> common problem that scripts run fine when you run them by hand (using an
>> interactive shell with one environment), but then doesn't work when run from
>> cron (or I guess in this case dhclient) with a totally different
>> environment. PATH is the a common issue here - cron (for example) uses a
>> much smaller PATH setting than interactive shells.
>>
>> It's one of those things that everyone does, and then they remember how much
>> it hurt and try to avoid being bitten by it again :-/
>>
>> --
>> Simon Hobson
>>




More information about the dhcp-users mailing list