LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
LinkBack Search this Thread
Old 09-26-2012, 12:06 PM   #1
sajjadshahid
LQ Newbie
 
Registered: Jan 2012
Posts: 4

Rep: Reputation: Disabled
Value after equal sign


Hi,
On linux, I am grepping a value from a config file and storing the output in a variable.
e.g.

appName='ApplicationName=xyz'

to get value after equal sign, i use
z=${appName/ApplicationName=/}

echo $z
gives
xyz

but on aix it gives error

[root@ssvr01]:/tmp># z=${appName/ApplicationName=/}
ksh: z=${appName/ApplicationName=/}: bad substitution

Please help,
Thanks,
 
Old 09-26-2012, 04:00 PM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 13,778

Rep: Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349Reputation: 2349
Quote:
Originally Posted by sajjadshahid View Post
Hi,
On linux, I am grepping a value from a config file and storing the output in a variable. e.g.

appName='ApplicationName=xyz'

to get value after equal sign, i use
z=${appName/ApplicationName=/}

echo $z
gives xyz

but on aix it gives error
[root@ssvr01]:/tmp># z=${appName/ApplicationName=/}
ksh: z=${appName/ApplicationName=/}: bad substitution
You don't provide many details, so its hard to say. First, your prompt on the AIX system is ksh...on Linux, it's probably bash. So, either change your shell environment on AIX to be bash and try it again, put a "#!/bin/bash" in your script on the AIX system so that it spawns a bash shell to run it, or try changing how the variable gets set.

You don't post the script, and one line isn't enough to see how things are working. You can try just putting a backslash in front of the equals sign and see if that'll work as a first step. If not, try what's suggested above, and post the script if you still can't get it going.
 
Old 09-27-2012, 12:27 AM   #3
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 247

Rep: Reputation: 106Reputation: 106
Hi sajjadshahid,

As TB0ne mentioned, based on the limited information supplied, we can only assume that you are using the default shells for the two platforms, and this is a ksh/bash difference issue.

If you are using the default /usr/bin/ksh on AIX, and you have a recent AIX version, you should try /usr/bin/ksh93 instead, which will fix your problem.

Alternately you can use bash on AIX as TB0ne suggested. Bash is not installed on AIX by default, but you can download it from the AIX Toolbox for Linux Applications at https://www-03.ibm.com/systems/power...box/alpha.html.

Good luck!
 
1 members found this post helpful.
Old 10-10-2012, 02:47 PM   #4
scheerchrs
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Rep: Reputation: Disabled
Agree with TB0ne & cliffordw; bone up on the deltas between variable assignment statements between the various shells; it's a simple syntax error. Or set your AIX shell in whatever account you're using to be the same shell as the linux box account shell that you started with.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 is equal to .999 szboardstretcher General 28 01-30-2011 02:24 PM
Try to start Knoppix but can't type equal sign jcksrobbins Linux - General 11 09-04-2009 10:33 PM
Shell script - Pass command options with equal sign fabdog Linux - Newbie 5 02-13-2009 06:32 AM
sign on invisible in gaim - NOT invi after sign on saravkrish Linux - Software 7 09-12-2005 10:55 PM
is this equal? shanenin Linux - Software 1 03-30-2004 01:08 PM


All times are GMT -5. The time now is 06:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration