Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

parameter type differences?



I have the following script, with appended output.  There are 3 cases tested, 
comparing a reference value for parameter "bref" with 3 values of parameter 
"b".  The utility od is used to verify the values of the "bref" and "b" 
parameters.  

My question is:  why are the values of "b" not equal to "bref" in cases 1 and 
2?  If the issue is parameter type, is there any way to display the parameter 
type for "b"?

Thank you.

================the script=============
#!/bin/zsh
emulate -R zsh
bref='
'
echo "case 1."
b='\012'
[[ ${bref} == ${b} ]] && echo same || echo diff
echo -n "${bref}" | od -b ; echo -n "${b}" | od -b
echo "case 2."
b='\n'
[[ ${bref} == ${b} ]] && echo same || echo diff
echo -n "${bref}" | od -b ; echo -n "${b}" | od -b
echo "case 3."
b='
'
[[ ${bref} == ${b} ]] && echo same || echo diff
echo -n "${bref}" | od -b ; echo -n "${b}" | od -b
exit 0
================the output============
case 1.
diff
0000000 012
0000001
0000000 012
0000001
case 2.
diff
0000000 012
0000001
0000000 012
0000001
case 3.
same
0000000 012
0000001
0000000 012
0000001
==================================



Messages sorted by: Reverse Date, Date, Thread, Author