In ksh, am trying to get a substring stuff done. Not sure where the problem is.. can you guys guide me on this...
for instance, var1=41, and var2=4175894567, then i want to know whether var2 starts with var1.. var1 and var2 can be of any length..
Plain ksh or pdksh can't do this kind of parameter expansion. It could be ksh93 can do it but I didn't try. bash can do it. You could instead use something like:
$> VAR1=41
$> VAR2=419068567777
$> if [[ $VAR1 == $(echo $VAR2| cut -c 1-${#VAR1}) ]]; then echo same; else echo different; fi
same
The man page of bash on my Debian Linux box has a good documentation about that topic "parameter expansion", while the AIX ksh man page is somewhat scarce for this.
On the web just google for "shell parameter expansion" or exchange shell vs. ksh or bash.