Well, you got me all enthused, sigh :-(.
Which requires a path. The objective (here) is not to put the scripts on a
path because they are transient and using PATH would be overkill. So:
./ Which does indeed provide a path ('.'). But so
does dirname $0.
source scripts/ Which can't fi
On Sun, 6 Feb 2005 09:20:53 -0800, wrote:
>I'm trying to find the directory of an executing bash script and am having
>very limited success. For example(s):
>
>1. /script.sh
>2. source /script.sh
>3. bash /script.sh
>
>I can find the correct only for the first example (dirname $0). PWD
>(of cour
the 3rd example works with dirname $0 as well.
In your 2nd example there is no script that is running. The
commands in the script are read as though you typed them in from
the terminal -- which means there is no "scriptname" to find
the name of.
You could check if $0 is equal to a shell name and g
3 matches
Mail list logo