Thanks Ghodmode,
Earlier you mentioned that
"If you wanted to have a variable that was set in a script available to you outside of the script, you would need to source it. There is a built-in source command available in the Bash shell, but most people just use its alias, which is just a dot...
Thanks Ghodmode
Okay I'm going to add another twist to this
Imagine we have 3 config files:
config1.sh contains "export VAR_NAME="Leo"
config2.sh contains "export VAR_NAME="Pat"
config3.sh contains "export VAR_NAME="Matt"
Now if we have the script printName
#!/bin/sh
VAR_SCRIPT=$1
...
Thank you very much Ghodmode
So when a variable is exported within a script is it only available to that script and all the scripts called from within that script?
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...
Hi,
is it possible to specify a label name for a unix script when running it?
Then when greping for the script afterwards one could just grep for the label name.
I want to be able to uniquely identify different instances of the same script running and I was wondering if I could add a unique...
Hi,
I have a table with 15 columns. However, in my data file I only have 9 columns. I have created a format file to map the data fields to the relevant columns. Each time I BCP data into the table though it just inserts the data into the first 9 columns regardless of the fact that I have mapped...
Hi,
I would like to check if my understanding is correct of how a single script creates new processes.
When the script starts initially it creates a new process. This is the parent process. Then as new processes are spawned within the script they will have a new PID but the PPID will be the...
At the beginning of a script I am writing I am trying to identify if the script is already running and if it is then exit the script.
At the moment I do a /usr/ucb/ps auxwww and exclude the current process id of the script and look for every other process with the script name. This doesn't work...
Hi,
the reason I am using the /usr/ucb/ps auxwww version of ps is so that it will not truncate the name of the process returned.
Is there any version of ps that I can use or any flag I can use with ps so that the name of the process will not be truncated and the PPID will also be returned...
Thanks PHV,
do you know if it is possible to return the parent process id with the command /usr/ucb/ps auxwww
I know it's possible with ps -ef
Just wondering about the other command.
Many Thanks
I came across this, which is what I think you were saying PHV
When you give a command to the Shell, it will fork a process to execute the command. While the child process is executing the command, the parent will go to sleep. Sleeping means that the process will not use any CPU time. It remains...
Hi PHV,
The script which is causing the problem is launched from another script as follows:
submitJob.sh ${JOB_PROFILE} $CONFIG_OVERRIDE_FILE
STATUS=$?
echo "submitJob.sh status: $STATUS"
Nothing complicated here. Just a call to the script.
The script submitJob.sh starts as follows...
Hi,
I have a Unix script which I start and then immediately after starting it I check to see if another process with the same script name but not the same current process id is running.
What I noticed is that when I launch this script. Just by calling its name from another script there are 2...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.