943,872 Members | Top Members by Rank

Ad:
Nov 1st, 2007
0

Error in script

Expand Post »
Hello,

I have a script I've used on pre-Solaris 10 that works just great. Now on a Sol10 box, it is bailing on this line with this error: syntax error at line 27: `|' unexpected
Here's the 'offending' line:
Shell Scripting Syntax (Toggle Plain Text)
  1. creation=`echo $backupid | sed 's/^.*_//'`
I'm a bit confused as to why this isn't working as I've pulled it out of the script and can run it successfully from the command line directly. Any ideas?

As always, thanks for the help!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rusman is offline Offline
17 posts
since Feb 2006
Nov 1st, 2007
0

Re: Error in script

Hey there,

From the info you've given I wrote this:

#!/bin/ksh

backupid="hi_there"
creation=`echo $backupid | sed 's/^.*_//'`
echo $creation

and ran it. It returned:

_there

Do you have more info on it? What would your backupid variable be set to? We're running Solaris 10 on hardware like V245's, T2000's and X4100's - also some Fujitsu PrimePowers. Also, it might be related to a patch. We're running the recommended patchset from April still.

Thanks,

, Mike
Reputation Points: 102
Solved Threads: 47
Posting Whiz
eggi is offline Offline
399 posts
since Oct 2007
Nov 1st, 2007
0

Re: Error in script

Click to Expand / Collapse  Quote originally posted by rusman ...
Hello,

I have a script I've used on pre-Solaris 10 that works just great. Now on a Sol10 box, it is bailing on this line with this error: syntax error at line 27: `|' unexpected
Here's the 'offending' line:
Shell Scripting Syntax (Toggle Plain Text)
  1. creation=`echo $backupid | sed 's/^.*_//'`
I'm a bit confused as to why this isn't working as I've pulled it out of the script and can run it successfully from the command line directly. Any ideas?

As always, thanks for the help!!
It shouldn't really make a difference, but the following change is always worth while, and worth a try:

Shell Scripting Syntax (Toggle Plain Text)
  1. creation=`echo "${backupid}" | sed 's/^.*_//'`

Edit: Since you're using ksh, you may also wish to change "echo" to "print".
Last edited by masijade; Nov 1st, 2007 at 9:12 pm.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: stumped need a start
Next Thread in Shell Scripting Forum Timeline: How to access parameters from another method in the same script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC