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
vino
2
#!/bin/ksh
fname="EOA.dmp"
echo $fname
logname="${fname}/.dmp/.log"
echo $logname
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.