Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline paul1981Topic starter

Path to insanity with Path command
« on: May 17, 2011, 09:28:35 PM »
Hello,

This is the first time I have been stumped when it comes to my Amiga, but I AM stumped, and it's time I learned to ask for help when needed!

Okay, I have a problem with the script below. Those commands used to be on the end of my user-startup file, but I found that it was causing problems with WHDLoad games, ie causing them to freeze etc. so I decided to just run the whole lot seperately in a script which I called "Enable-Networking" and I saved this script into s:
See below...

;
;BEGIN PCMCIACARD NETWORK SETUP
SetPrism2Defaults SSID BTHomeHub2-P32N KEY 9583218079
;END
;BEGIN AmiTCP/IP
assign AmiTCP: Workbench:Expansion/AmiTCP
path AmiTCP:bin add
;AmiTCP:bin/login -f amiga_user >"con:*/*/*/200/AmiTCP-IP Login/AUTO/CLOSE/WAIT"
AmiTCP:bin/umask 022
AmiTCP:bin/startnet
;END AmiTCP/IP
;BEGIN AmiSSL
Assign AmiSSL: "Workbench:Expansion/AmiSSL"
If Exists AmiSSL:Libs
   Assign LIBS: AmiSSL:Libs ADD
EndIf
Path AmiSSL: ADD
;END AmiSSL
;

I gave the script a project icon, and made the default tool "IconX".
I then "left it out", so I could click on it from the desktop to turn on whenever I needed to use the internet with IBrowse.
I also added an entry into ToolsDaemon too which executes the script.

The problem I have is that none of the Paths are set up after the script has run, whether it be from "execute s:enable-networking" in ToolsDaemon, or clicked on from it's icon I created, although everything else in the script appears to work. So the AmiSSL path and AmiTCP/bin path just don't appear to set up. I verify this by typing "path" in a new shell. So I can't use the command ping for instance. Of course, I could just stick those back in the user-startup and they'd be there but I prefer to keep things neat and together.

I did find though that if I "execute s:enable-networking" from the shell, then the paths do get set up.
I'd just like to know why the path commands don't work unless I execute the script from the shell....It's driving me up the wall! :madashell:
Thank you in advance.

P.S. I'm running Workbench/Kickstart 3.1 on an A1200.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Path to insanity with Path command
« Reply #1 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 kolla

Re: Path to insanity with Path command
« Reply #2 on: May 18, 2011, 12:53:35 AM »
Quote from: Piru;638498
If you execute a script from some external command such as IconX or ToolsDaemon, it will only affect that particular shell and any siblings of it.

Siblings? Surely you mean "children", or how does that stuff work in Finland again?
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline paul1981Topic starter

Re: Path to insanity with Path command
« Reply #3 on: May 18, 2011, 01:17:44 AM »
Thanks Piru.  Weird...I wonder why AmigaDOS/Path was designed that way?  I'm not clever enough to answer that but I'm sure lots are. So it seems I'll have to add those paths back into my user-startup after all.
Everything else in the script worked, including the assigns of course...that's what stumped me....but thanks for answering my question.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Path to insanity with Path command
« Reply #4 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.
 

Offline Zac67

  • Hero Member
  • *****
  • Join Date: Nov 2004
  • Posts: 2890
    • Show only replies by Zac67
Re: Path to insanity with Path command
« Reply #5 on: May 18, 2011, 10:18:00 AM »
Environment variables and such are always local, at least on all operating system I've seen so far.

If you try to make an OS run with global settings you'll quickly run into several problems: What happens when one process changes a variable? Is there a notification mechanism to tell everyone else? When an important variable changes in mid-air, does a process have to restart processing from the beginning?