LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 05-07-2010, 06:54 AM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 154

Rep: Reputation: 15
please solve ${tpPath##a}


I have following code in script

Code:
tpPath="adae"
tempPath=${tpPath##a}
echo $tempPath
If first character is "a" then It replaces with empty string.
It works fine in linux but on solaris i am getting "bad substitution" error

Please help me to fix this

ThanQ,
Nagendra
 
Old 05-07-2010, 07:22 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Like in your other thread, this probably isn't supported in the shell you are using.

This should do what you want (strip the first a if present):
echo $tpPath | sed 's/^a//'

Hope this helps.
 
Old 05-07-2010, 07:24 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Please don't start a new thread when the issue is so similar to the other one.

The root cause isn't that much Solaris vs Gnu/Linux, just different shells. The simpler for you might be to switch to a shell that support the used syntax, likely bash.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP help!!! help me solve this please!! (T.T) anzdyy General 3 09-08-2007 07:27 AM
HELP help!!! help me solve this please!! (T.T) anzdyy Linux - Desktop 3 09-08-2007 03:32 AM
HELP help!!! help me solve this please!! (T.T) anzdyy Linux From Scratch 5 09-08-2007 02:12 AM
HELP help!!! help me solve this please!! (T.T) anzdyy LinuxQuestions.org Member Success Stories 1 09-08-2007 01:35 AM
could you solve that? amigo28 Linux - Software 2 02-12-2007 03:51 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 02:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration