Welcome, Guest. Please login or register.

Author Topic: Path to insanity with Path command  (Read 6569 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Path to insanity with Path command
« on: May 17, 2011, 10:25:47 PM »
Quote from: paul1981;638483
I'd just like to know why the path commands don't work unless I execute the script from the shell.

They work just fine, and as expected.

In order to understand what happens you need to understand that "path" is an attribute that is inherited from the parent shell. If you execute a script from some external command such as IconX or ToolsDaemon, it will only affect that particular shell and any children of it. Usually those scripts don't launch a new shell however, and thus the path will be forgotten as soon as the script terminates.

When you have the path commands in the startup-sequence (or any sub-script of that it: such as user-startup) the path will be the one that all other shells inherit. Additionally LoadWB command will "clone" the current path at the time of the command launch. This is why newshell from Workbench also has the correct path. There's also LoadWB option (NEWPATH/S) to refresh the path Workbench uses. Again it will clone the current path of the shell at the time of the loadwb refresh.
« Last Edit: May 18, 2011, 07:51:38 AM by Piru »
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Path to insanity with Path command
« Reply #1 on: May 18, 2011, 08:01:29 AM »
Quote from: paul1981;638525
Thanks Piru.  Weird...I wonder why AmigaDOS/Path was designed that way?

To allow different path configurations for different shells I suppose. My guess is that this emulates the unixoid shell PATH variable, which also is local and is inherited.