![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sun storage L7 Problem | hadibn | SUN Solaris | 0 | 04-03-2008 02:04 AM |
| Storage Solutions: Oracle and Symantec Certify Veritas Data - Data Storage Connection | iBot | UNIX and Linux RSS News | 0 | 07-20-2007 01:40 AM |
| killing PID's of ptree | abhijeetkul | Shell Programming and Scripting | 0 | 06-20-2006 08:16 AM |
| Find PID's | vibhor_agarwali | UNIX for Advanced & Expert Users | 2 | 08-16-2005 06:26 AM |
| Some problem about usb mass storage device | niukun | Linux | 2 | 12-08-2004 01:05 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem with storage of PID's to variables
I have the following problem to be solved:
I read a .csv file (tempfile), fetch the values into variables F1 to F5. Variables F1, F2, F3 are parameters used for running a program (blablaprogram). Variable F4 I want to use to store the PID-value in and variable F5 is used for storing the return value of the wait-process. I want to distinquish the several parallel processes and monitor if they are finished. Problem is that I cannot store the PID into variables and read the content of the variable. At the line : echo "\n\t`date`:\t$F4 ........ , $F4 contains the variablename that has been read from the flatfile i.o. the PID. Has anyone a suggestion? The code (KSH) is shown underneath: IFS="," while read F1 F2 F3 F4 F5 do blablaprogram $F1 $F2 > $LOGDIR/bes006_$F3.log 2>&1 & set $F4=$! echo "\n\t`date`:\t$F4 is Process ID for job waiting on $F1$F2" wait $F4 # Wait until background process $F4 completes ... set $F5=$? echo "\n\tPID $F4: blabla Return Value for $F1$F2 concatination is: $F5" case $F5 in 0) echo "\n\tConcatination on $F1$F2 COMPLETED Successfully" ;; 1) echo "\n\t!!! WARNING: Likely DATA ERROR ... !!!" ;; 2) echo "\n\t!!! FATAL ERROR ... !!!" ERRORS=10; exit $ERRORS ;; esac echo "\n\t*********************************************************************" done < $TEMPFILE IFS=" " |
|
|||||
|
Quote:
But what, from my point of view, is a little bit confusing is the "set $F4=$!". I mean, why "set $F4"? I would use simply "F4=$!"... Continuing with what Perderabo said, perhaps this could help you ![]() Code:
#!/bin/bash for i in 1 2 3 4 5 6 7 8 9; do ( sleep 10 & wait $! echo "sleep $i output was: $?" ) & done Tested in bash. Regards. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|