From: markryde on 28 May 2010 10:42 Hi, I have a question about bash period command. I have this script, b.sh , which should run another script: #!/bin/sh .. a.sh a.sh is a simple script, which echoes "in a.sh" on the terminal. more a.sh #!/bin/sh echo in a.sh when running b.sh I get an error: ../b.sh ../b.sh: line 2: .: a.sh: file not found Now, I run this script from tcsh; and adding, before running it, setenv PATH ${PATH}:. does avoids this error. But I want to be able to run this scripts on machines where I don't want to change the PATH. What should I do ? and BTW, when Bash is not in posix mode? (the following section from bash reference manual triggers this question) .... .. (a period) . filename [arguments] Read and execute commands from the filename argument in the current shell context. If filename does not contain a slash, the PATH variable is used to find filename. When Bash is not in posix mode, the current directory is searched if filename is not found in $PATH. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the exit status of the last command executed, or zero if no commands are... rgs, Mark
From: Janis Papanagnou on 28 May 2010 10:58 markryde(a)gmail.com wrote: > Hi, > I have a question about bash period command. > > I have this script, b.sh , which should run another script: > > #!/bin/sh > . a.sh > > a.sh is a simple script, which echoes "in a.sh" on the terminal. > > more a.sh > #!/bin/sh > echo in a.sh > > when running b.sh I get an error: > > ./b.sh > ./b.sh: line 2: .: a.sh: file not found > > Now, I run this script from tcsh; and adding, before running it, > setenv PATH ${PATH}:. > does avoids this error. But I want to be able to run > this scripts on machines where I don't want to change the PATH. In b.sh change the call to . ./a.sh i.e. add a relative path component ./ in front of the filename. Janis > > What should I do ? > and BTW, when Bash is not in posix mode? (the following section from > bash reference manual triggers this question) > ... > . (a period) > > . filename [arguments] > > Read and execute commands from the filename argument in the > current shell context. If filename does not contain a slash, the PATH > variable is used to find filename. When Bash is not in posix mode, the > current directory is searched if filename is not found in $PATH. If > any arguments are supplied, they become the positional parameters when > filename is executed. Otherwise the positional parameters are > unchanged. The return status is the exit status of the last command > executed, or zero if no commands are... > > > rgs, > Mark > > > > >
|
Pages: 1 Prev: Equivalent csh construct to "set -- $var" Next: Suggession for your website |