Shell Scripting Gurus,
I am having a hard time
trying to figure out what I am doing wrong in my script. Below is the script snippet. It gives an error when it tries to execute the expression.
a=`expr substr $stringZ 5 10`
#!/bin/bash
echo "Hello"
stringZ="abcABC123ABCabc"
echo $stringZ
echo "Length is ${#stringZ}"
echo `expr "$stringZ" : '.*'`
a=`expr substr $stringZ 5 10`
echo $a
output :
Hello
abcABC123ABCabc
Length is 15
15
expr: syntax error
$
What am I doing wrong? Why is it giving syntax error when it executes
a=`expr substr $stringZ 5 10`
Can one of you gurus out there help me fix this?
Thanks a lot!
Ajay.