|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Doing Multiple task using shell script on Aix Unix
I try creating a shell script where it will call a text file containing list of items then call up an sql program.
But it was given me error message. I need help. Below is the script: echo "$0 : running multiple transactions..." while read -r getaccount do date1=echo $getaccount | cut -d" " -f1 date2=echo $getaccount | cut -d" " -f2 pause sqlplus -s fbndev/fbndev @cotdrebuildx.sql $date1 $date2 done < $getaccount.txt echo "$0 : Correction of Last Balances of accounts Completed Successfully" exit 0 below is the error message: running multiple transactions... A file or directory in the path name does not exist. ./sample.sh[9]: .txt: 0403-016 Cannot find or open the file. The file getaccount text file,the shell script and sql program are in same directory. Please i need an asistance in other to correct this problem or suggest a better way of achieving my objective |
|
#2
|
|||
|
|||
|
try using full path to file
|
|
#3
|
||||
|
||||
|
I would be more inclined to be consistent in naming the file ... $getaccount and $getaccount.txt are both used.
__________________
According to Sod's Law, buttered toast lands butter side down, when dropped. Per nature, cats always land on their feet. So, what happens when you strap buttered toast to the back of a cat and throw it out a window?. |
|
#4
|
||||
|
||||
|
Quote:
i wonder without assigining the value of the operation to date1 and date2 how both the variables would be effected, you need to use as, Quote:
|
|
#5
|
|||
|
|||
|
Doing Multiple task using shell script on Aix Unix
Thanks guys, I have moved a step forward. The error reported earlier was not displaying again.
But the system hung after executing the srcipt (sample.sh). Try troubleshooting, and discovered that the file is not being read (getaccount). so it is not passing the parameter date1 and date2 to the sqlplus program. What else can I do. Below is the fie getacount 25-01-2005 25-02-2005 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "getaccount" 1 line, 22 characters The script is now amended like this: echo "$0 : running multiple transactions..." while read -r getaccount do date1='echo $getaccount | cut -d" " -f1' date2='echo $getaccount | cut -d" " -f2' echo $f1 echo $f2 sqlplus -s fbndev/fbndev @cotdrebuildx.sql $date1 $date2 done < $getaccount echo "$0 : Correction of Last Balances of accounts Completed Successfully" exit 0 ~ ~ ~ ~ ~ ~ ~ ~ ~ "sample.sh" 14 lines, 402 characters pleas i need further suggestion to solve this peoblem |
|
#6
|
|||
|
|||
|
Quote:
what difference the above is going to make? I mentioned to use backticks ` and not the single quotes just use backticks and not the quotes date1=`echo $getaccount | cut -d" " -f1` date2=`echo $getaccount | cut -d" " -f2` |
|
#7
|
|||
|
|||
|
Could not read from the text file(getaccount) to the sql
Sorry, am still having problem. The shell script could not read from the getaccount file. I expect that the sql will pick the content of the text file getaccount into the sql without user intervention.
Please I still need assistance. Below is the script again for your peruse. ____________________________________________________ echo "$0 : running multiple transactions..." while read -r getaccount do date1=`echo $getaccount | cut -d" " -f1` date2=`echo $getaccount | cut -d" " -f2` sqlplus -s fbndev/fbndev @cotdrebuildx.sql $date1 $date2 done < $getaccount echo "$0 : Correction of Last Balances of accounts Completed Successfully" exit 0 |
|
#8
|
|||
|
|||
|
not sure,
just check whether the variable getaccount is assigned properly with the filename to be processed. i suspect at that point only. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Doing Multiple task using shell script on Aix Unix |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|