The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
AWK substitution klut Shell Programming and Scripting 4 01-15-2008 08:26 AM
Formatting Substitution Command Not Working in vi ERPKEN UNIX for Advanced & Expert Users 11 05-06-2007 06:36 PM
Substitution not working in ksh arsheshadri SUN Solaris 3 04-12-2007 08:20 PM
Bad Substitution D_Redd74 Shell Programming and Scripting 3 02-07-2007 02:48 PM
Var substitution in awk - not working as expected videsh77 Shell Programming and Scripting 3 01-13-2006 10:57 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-11-2007
Registered User
 

Join Date: Jan 2007
Posts: 14
Substitution not working in ksh

Following code is working in bash but not in ksh.
Can someone please send me an alternative?

#!/bin/ksh
fname="EOA.dmp"
echo $fname
logname=${fname/.dmp/.log}
echo $logname


I am getting below error in ksh
"testcmd[4]: logname=${fname/.dmp/.log}: 0403-011 The specified substitution is not valid for this command."

Thanks & Regards
Sheshadri
Forum Sponsor
  #2  
Old 04-12-2007
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Quote:
Originally Posted by arsheshadri

#!/bin/ksh
fname="EOA.dmp"
echo $fname
logname=${fname/.dmp/.log}
echo $logname
Code:
#!/bin/ksh
fname="EOA.dmp"
echo $fname
logname="${fname}/.dmp/.log"
echo $logname
  #3  
Old 04-12-2007
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
The code posted is valid for ksh93, as stated in the duplicate post here.

Anyway, fork yourself a process and save all this hassling about if you must use ksh88:

logname=$( echo ${fname} | sed 's/\.dmp$/\.log/' )

Cheers
ZB

P.S. Thread closed. No duplicate/cross-posting. Read the rules.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0