Computing.Net > Forums > Unix > shift command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

shift command

Reply to Message Icon

Name: soonann
Date: October 16, 2004 at 05:55:12 Pacific
OS: aix
CPU/Ram: PowerPC_POWER3 4G
Comment:

Hi

I have this problem where message is passed over to unix as variables after the script for the script to process using shift command. Problem is some variables are too long and it seems to truncate the closing double quote (").
eg
/usr/local/testscript 11.81.8.3 N/A ServiceCenter TWS tec WR123445 Application
s "Open Systems" batch C342QLW CF04289AAAAAAADI CRITICAL "Oct 16 17:52:22 2004" "Job CF04289AAAAAAADI.CRMSQLW failed, continuing with sched

Any one can suggest how to terminate with the double(") as it seems like it has reached the maximum key entry allowed ? (Shortening of the message is not accepted as the message can be even longer than this eg.)

Would appreciate if some one can show me there is another way of passing variable other than this.

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: thepubba
Date: October 19, 2004 at 08:46:36 Pacific
Reply:

I put your string into a data file I called junk.data. I then wrote a short ksh script called junk.ksh as follows:

#!/bin/ksh

for value in $*
do
print $1
shift
done

I then ran this command:

./junk.sh $(cat junk.data)

My output looked like this:

11.81.8.3
N/A
ServiceCenter
TWS
tec
WR123445
Applications
"Open
Systems"
batch
C342QLW
CF04289AAAAAAADI
CRITICAL
"Oct
16
17:52:22
2004"
"Job
CF04289AAAAAAADI.CRMSQLW
failed,
continuing
with
sched"

Not sure where you wanted the terminating " so I put it at the end of the string. Anyway, this script shows that your entire string is being read. Need a little more detail and perhaps someone can figure out your problem.



0
Reply to Message Icon

Related Posts

See More


ls command Shell script to create l...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: shift command

Korn Shell Scripting Query www.computing.net/answers/unix/korn-shell-scripting-query/2999.html

need help with unix script www.computing.net/answers/unix/need-help-with-unix-script/8209.html

getopts command www.computing.net/answers/unix/getopts-command/4416.html