Variable syntax error in $?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Variable syntax error in $?
# 8  
Old 05-29-2013
thanks all for ur replies ..
Am using csh here since that is my only option Smilie
i found out hw to take the PID in csh , now can anyone help me to take the success or failure status of the last script before running the next one ?
cos if i use $status its returning me the status of the PID command tat i used .
here is my sample code :
Code :
Code:
#!/bin/csh -f

./1.sh &
set PID=`ps | grep 1.sh | awk '{print $1}'`
set PD = `echo $PID`
while (  $PID == $PD )
sleep 10
set PD = `ps | grep 1.sh | awk '{print $1}'`
end

exit(0)

Now i want to check the success or failure status of 1.sh before invoking 2.sh inside the above script .

---------- Post updated at 12:08 PM ---------- Previous update was at 11:48 AM ----------

Moderator's Comments:
Mod Comment Please no bumping up of double posting

Last edited by Scrutinizer; 05-29-2013 at 02:48 PM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash function using variable in it syntax error

The below bash function uses multiple variables CODING, SAMPLE, SURVEY, andvariant in it. The user selects the cap function and details are displayed on the screen using the $SURVEY variable, the directory is changed to $SAMPLE and the samples.txt is opened so the user can select the sample to... (6 Replies)
Discussion started by: cmccabe
6 Replies

2. Shell Programming and Scripting

"Syntax Error sometimes due to corruption of variable value "

Hi , I have script as follows , #!/usr/bin/ksh -x if then alias echo="echo -e" fi MAX_ENTRIES=1024 nb_of_entries=`echo "$list_of_entries" | wc -w` # Set number of tables eval nb_of_tables=\`expr `expr $nb_of_entries / $MAX_ENTRIES` + 1 \` # Output the number of tables echo... (6 Replies)
Discussion started by: breezevinay
6 Replies

3. Shell Programming and Scripting

Syntax error: Bad for loop variable

I'm getting an error while running this script. Need help. set -x verbose #echo on clear #clear the screen USERNAME="bbb" PASSWORD="password" SERVER="192.168.1.100" WAIT_TIME=300 FILE_PATH="/home/users/xxx/MMM" # local directory to pickup *.dat file REMOTE_PATH="/Drop_off/xxx/yyy" #... (17 Replies)
Discussion started by: clgz2002
17 Replies

4. Shell Programming and Scripting

Syntax error: Bad for loop variable

Hi Can any one help, I'm trying to run a script that beeps out the ip address from the PC internal speaker with the following script. It keeps throwing the error "Syntax error: Bad for loop variable" on line 16. I know its picking up the IP ADDRESS correctly. Any ideas on whats wrong. I'm... (3 Replies)
Discussion started by: dman
3 Replies

5. Shell Programming and Scripting

Syntax error on variable assignment

Hello all, I have "inherited" a Korn shell script I'm supposed to maintain, and running a "sh -n" on it, I got this syntax error: script.sh: syntax error at line 63: `OB_DEVICE=$' unexpected The line in cause is the first occurence of the usage of perl one-liners. The whole line: ... (2 Replies)
Discussion started by: AdrianM
2 Replies

6. Shell Programming and Scripting

How do I write multiple variable syntax?

I am trying to write a script that will do a sql statement. But in the sql I will have a list (1,2,3,4). How would I go about asking for the input from the user running the script, and then transferring that back into the list as say ($var1,$var2,$var3)? It would be somewhat like this: ... (1 Reply)
Discussion started by: Captain
1 Replies

7. UNIX for Dummies Questions & Answers

Variable syntax and lines of code

I am trying to use use the AWK and EGREP commands together in an AWK script. My overall objective is to count lines of code but exclude comments and blank lines and such. I am able to use AWK with the FIND command like so: | awk '{print \"wc -l \"$1}' > lineCount.sh Now when I modify the... (7 Replies)
Discussion started by: mastachef
7 Replies

8. Solaris

C-shell: variable syntax question

There is a possibility to set a variable, having an another variable in it's name: prompt% setenv PRT one prompt% setenv VAR_${PRT} value prompt% So, this way the VAR_one = "value" and could be viewed: prompt% echo VAR_one value prompt% Q: How to view a variable having another... (0 Replies)
Discussion started by: alex_5161
0 Replies

9. UNIX for Dummies Questions & Answers

Setting a variable (need syntax help)

I need some syntax help (working in a bash shell) I have a variable which is a filename with an extension, and I need to create another variable with the same name but a different extension To explain, the input file should be called something like "filename.L1" and the output file should be... (1 Reply)
Discussion started by: Slanter
1 Replies

10. Shell Programming and Scripting

Syntax to export any variable

How to export variables on a UNIX prompt. Please provide me syntax. Thanks in advance. Malay (5 Replies)
Discussion started by: malaymaru
5 Replies
Login or Register to Ask a Question