0 Replies Latest reply on Apr 13, 2016 11:30 AM by 3212603

    shell script throws bad substitution error in concurrent program


      I'm trying to add the below string manipulation commands in my existing shell script.

      #!/bin/ksh y=${#text} echo "Length of text: $y" echo "Last _ is in column $((${#text} - ${#end}))" echo "Our position is till column $((${#text} - ${#end}-$x))"  len=`expr $((${#text} - ${#end}-$x))` echo $len  val=$( echo $text $len|awk '{print substr($0,0,$2)}')  echo $val count=`ls $val*|wc -l` echo $count 

      The above commands works fine when executed in terminal. but when i add to my existing shell script which is running as a concurrent program, the program errors out throwing the error "Bad substitution". And i'm able to identify that the it errors out at the code added recently for string manipulations.

      I can see the code is interpreted as korn shell and I've used korn shell commands only which works in terminal but when added to existing concurrent program's unix script it errors out.

      Below is the code in my existing script along with newly added commands


      for file in `ls *_GL_*.dat` do echo "File being processed $file" FILENAME=$file #echo $FILENAME len=${#FILENAME} --->error thrown for this command echo "The length is $len"