0 Replies Latest reply on Apr 13, 2016 9:42 AM by 3212603

    Unix shell script executes in terminal but not as concurrent program

    3212603

      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 scrip which is ran 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.