954,136 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error in script

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:

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!!

rusman
Newbie Poster
20 posts since Feb 2006
Reputation Points: 10
Solved Threads: 0
 

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

eggi
Posting Pro in Training
400 posts since Oct 2007
Reputation Points: 102
Solved Threads: 47
 

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:

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:

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


Edit: Since you're using ksh, you may also wish to change "echo" to "print".

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You