User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,442 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,610 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 662 | Replies: 2
Reply
Join Date: Feb 2006
Posts: 15
Reputation: rusman is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
rusman rusman is offline Offline
Newbie Poster

Question Error in script

  #1  
Nov 1st, 2007
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!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 306
Reputation: eggi is on a distinguished road 
Rep Power: 2
Solved Threads: 29
eggi eggi is offline Offline
Posting Whiz

Re: Error in script

  #2  
Nov 1st, 2007
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
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Join Date: Feb 2006
Posts: 1,509
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: Error in script

  #3  
Nov 1st, 2007
Originally Posted by rusman View 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:
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".
Last edited by masijade : Nov 1st, 2007 at 9:12 pm.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 1:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC