Hi,
could somebody please advise me about the scope of variables in a bourne shell script in
the following situation:
If I have a script printName - just for simplicity
#!/bin/sh
VAR_NAME=$1
export $VAR_NAME
while [ true ]
do
echo $VAR_NAME
done
Now if I run this 3 times concurrently
./printName Leo
./printName Pat
./printName Al
Is there any danger of the variable VAR_NAME getting mixed up in the 3 scripts?
In practise this script wouldn't be run interactively. Instead it would be run by a cron job
and picking up a new name each time.
From what I understand when a variable is exported it is available to all scripts then run in the environment????
Would greatly appreciate some advice about this.
Thanks
could somebody please advise me about the scope of variables in a bourne shell script in
the following situation:
If I have a script printName - just for simplicity
#!/bin/sh
VAR_NAME=$1
export $VAR_NAME
while [ true ]
do
echo $VAR_NAME
done
Now if I run this 3 times concurrently
./printName Leo
./printName Pat
./printName Al
Is there any danger of the variable VAR_NAME getting mixed up in the 3 scripts?
In practise this script wouldn't be run interactively. Instead it would be run by a cron job
and picking up a new name each time.
From what I understand when a variable is exported it is available to all scripts then run in the environment????
Would greatly appreciate some advice about this.
Thanks