That part is telling ya to assign the script name to the variable prgname, what it does (the cat part) and he's executing it in background (&). You can see the process id of the script at the end (25806).
He's just showing you that the script is already running so you can test it.
That part is the actual loop thats looking for the running script. [ ] Tests if the script is already running. If it does it echo's "(script name) running!". The last part is the actualy the result of the command which tells you ... yeah your script is running.
Back a bit... the test part.
[ ] this is the test part. So if [test] is true do something.
Test what? If the variable exist. If it exists you want to know.
ps -ef will list the processes (good thing to know if your looking for a process).
He's pipping it into a awk which will search for the variable prgname BUT will leave out awk. You always want to do this cause else it will always return with your actual search. See ex:
You want the second one but not the first one. So the AND operator (&&) is really needed here to skip your search.
Ok ... last thing he does ... he assigns the result to a variable PLUS a dot "$(bla bla bla bla)."
See the trailling dot at the end? Thats actually needed incase your result is empty. If it is your variable will be a simple dot. That simple dot will be compared the other part of the test "."
That != says NOT equal so if it finds your script name that test will look like:
test.sh. (see the dot at the end of test.sh) NOT equal to dot
That test is true so do somehing.
In case its not running the test will look like this:
"." NOT equal to "." which is not true so it will skip the "do something part"
Hope it helped. Thats really the simplest i can do.
I am trying to set up a variable based on the name of the file.
function script_name {
if
then
job_name='MONITOR'
return job_name;
elsif
then
job_name='VERSION'
return job_name
fi
}
for i in `ls *log`
do
script_name $i
done. (4 Replies)
I'm trying to create a directory from my Perl script. Only if the there was an error I want to let the user know about it. So if the folder exists is ok.
This is what I think should work:
`mkdir log 2>/dev/null`;
if($? == 0 || $? == errorCodeForFileExists)
{ everyting is fine }
else
{... (3 Replies)
hi
i have a file, i am reading line by line and checking a line contains a string ,
`grep "Change state" $LINE`
if
then
echo "The line contains---"
else
echo "The line does not contains---"
i need to check the return code , but i am getting an error
... (4 Replies)
hi friends ,
i need c code for my app,
in my app the user can create the new user for the system,
while creating the new user ,i try to include the condition
the user name is not present in password.
my exe requrment is : the user name char is not present in password,if the password... (6 Replies)
I have a short line of code that checks very rudimentary for duplicate code:
sort myfile.cpp | uniq -c | grep -v "^.*1 " | grep -v "}"
It sorts the file, counts occurrences of each line, removes single occurrences and removes the ubiquitous closing brace. The language is C++, but is easily... (3 Replies)
Hi, (i'm sorry for my english)
I'm a problem on boot sco unix 5.0.5 open server.
this stop at "Checking protected password and checking subsystem databases"
(See this image )
I'm try this:
1) http://www.digipedia.pl/usenet/thread/50/37093/#post37094
2) SCO: SCO Unix - Server hangs... (9 Replies)
#!/bin/ksh
#This script will check status of load balancer in AIX servers from hopbox
#Steps to do as folows :
#Login to server
#netstat -ani | grep <IP>
#check if the output contains either lo0 OR en0
#if the above condition matches, validation looks good
#else, send an email with impacted... (7 Replies)
Hi,
I am writing the shell script in ksh to check certain no of files exists,In my case there are 7 files exist like below
Sales1_timstamp.csv
Sales2_timstamp.csv
Sales3_timstamp.csv
Sales4_timstamp.csv
Sales5_timstamp.csv
Sales7_timstamp.csv
Sales7_timstamp.csv
Once all the files... (4 Replies)