Shell script

I have two scripts a.shl and b.shl. In the script b.shl, there is a line

". a.shl"

what does this denote?

hi vijay,

its calling the script a.shl inside b.shl. i mean to say script a.shl is running in b.shl.

dot(.) is there before a.shl .it denotes the working directory.

subhendu81,I am afraid that might be wrong....Im not sure what it does but I am sure the script a.shl is not being run here....bcos I tested it by givin some echo statements in a.shl.....So a.shl is not being run here...Also note there is a space between "." and "a.shl"..so dot does not denote current dir

hi,

can u plz send me the code..so that i can clarify ur doubt easily...

contents of a.shl

echo "hi"
echo "this a.shl"
. b.shl
echo "$a"
echo "done"

contents of b.shl

export a="var"
echo "this is b.shl"

The dot is the shell's "source" command. When you run one script from another, normally they are distinct processes, and the child process cannot change anything in the parent process. In some scenarios you want the invoked script to modify the invoker's environment (typically, to set some environment variables) and in those scenarios, the "source" command is the ticket.

In this particular case, the value of $a is visible inside a.shl after it sources b.shl. Without the dot, this would not be the case.

(Conventionally .sh is used as the extension for shell scripts; but often, it's better to not have any extension.)

Thanks era...i think that answers my question....thanks very much