UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 23rd, 2006, 02:16 PM
Gabin Gabin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 6 Gabin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 49 m 14 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 23rd, 2006, 02:26 PM
playskool playskool is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 48 playskool Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 23 h 5 m 35 sec
Reputation Power: 0
try using full path to file

Reply With Quote
  #3  
Old June 24th, 2006, 11:22 PM
Ehlanna's Avatar
Ehlanna Ehlanna is offline
Not a clue what to put ...
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2006
Location: in front of this keyboard
Posts: 814 Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 5 h 10 m 43 sec
Reputation Power: 243
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?
.

Reply With Quote
  #4  
Old June 25th, 2006, 01:22 AM
madmatrix madmatrix is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 10 madmatrix User rank is Private First Class (20 - 50 Reputation Level)madmatrix User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 11 m 52 sec
Reputation Power: 0
Quote:
date1=echo $getaccount | cut -d" " -f1
date2=echo $getaccount | cut -d" " -f2


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:
date1=`echo $getaccount | cut -d" " -f1`
date2=`echo $getaccount | cut -d" " -f2`

Reply With Quote
  #5  
Old June 26th, 2006, 06:35 AM
Gabin Gabin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 6 Gabin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 49 m 14 sec
Reputation Power: 0
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

Reply With Quote
  #6  
Old June 26th, 2006, 08:08 AM
madmatrix madmatrix is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 10 madmatrix User rank is Private First Class (20 - 50 Reputation Level)madmatrix User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 11 m 52 sec
Reputation Power: 0
Quote:
date1='echo $getaccount | cut -d" " -f1'
date2='echo $getaccount | cut -d" " -f2'


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`

Reply With Quote
  #7  
Old June 28th, 2006, 12:52 PM
Gabin Gabin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 6 Gabin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 49 m 14 sec
Reputation Power: 0
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

Reply With Quote
  #8  
Old June 29th, 2006, 10:29 PM
madmatrix madmatrix is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 10 madmatrix User rank is Private First Class (20 - 50 Reputation Level)madmatrix User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 11 m 52 sec
Reputation Power: 0
not sure,

just check whether the variable getaccount is assigned properly with the filename to be processed.

i suspect at that point only.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Doing Multiple task using shell script on Aix Unix


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway