Question : String substring?

Everyone:
Good afternoon.  If I wanted the first 4 characters of a string wouldn't I just:

#!/usr/bin/ksh
string=ABCDEJGHIJ
snip=${string:0:4}
echo $snip

I can't seem to make the snip variable contain what I want.  The only progress (see "Knowledge level on this subject :) ) I've been able to make is to set the Start parameter to a negative number which retruns the whole string.

As always many thanks for the help and encouragement.

RC

Answer : String substring?

I think it depends on your version of ksh as to whether this syntax is supported.

If you have run your script with bash, it will work.
Random Solutions  
 
programming4us programming4us