Shell FreeBSD equivalent of {SET/END}LOCAL

balanga

Son of Beastie

Reaction score: 137
Messages: 3,059

Does FreeBSD have the equivalent of DOS's {SET/END}LOCAL ? These commands allow a temporary change to the environment which is restored to the original with the ENDLOCAL command.

What I'm trying to do is run a script SCR2 from SCR1 both of which are in the same directory, but SCR1 does a cd so that SCR2 is not in CWD.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,698
Messages: 30,639

In SCR1 find the base path and store it (use basename(1)/dirname(1) on $0 for example). Then start your second script as $basedir/SCR2.
 
Top