Hello,
I am using Microsoft Services for UNIX to port Korn shell scripts towards a NT environment.
In order to evaluate an environment variable passed on the command line, I wrote:
hlp=$(echo "$"$1)
result=`eval echo $hlp`
On OSF and HP/UX, the result variable now contains the value of the environment var. whose name is in $1.
On NT, this result variable has a carriage return appended to it.
I can remove this by typing
result2=${result:0:22}
if I know the significant length, but normally I do not know the length.
So how can I check whether there is a CR or LF present in an environment variable, and how can I remove it in a simple way ?
Regards,
Luc
I am using Microsoft Services for UNIX to port Korn shell scripts towards a NT environment.
In order to evaluate an environment variable passed on the command line, I wrote:
hlp=$(echo "$"$1)
result=`eval echo $hlp`
On OSF and HP/UX, the result variable now contains the value of the environment var. whose name is in $1.
On NT, this result variable has a carriage return appended to it.
I can remove this by typing
result2=${result:0:22}
if I know the significant length, but normally I do not know the length.
So how can I check whether there is a CR or LF present in an environment variable, and how can I remove it in a simple way ?
Regards,
Luc