/bin/sh variable substitution
Dave Sherman
dave at utcsrgv.UUCP
Sun Jul 1 23:10:59 AEST 1984
In article <4260 at mordor.UUCP> jdb at mordor.UUCP (John Bruner) writes:
~| I noticed recently that the (Bourne) shell's ${X=y} construction
~| does not have the behavior that I expected. It appears that when
~| a variable is assigned a quoted value, for example:
~|
~| ${XYZZY="plugh"} <or> ${XYZZY='plugh'}
~|
~| that every character of the quoted value is stored with the 0200
~| bit on. Normally this has no visible effect because the shell
~| strips the eighth bit (along with non-printable characters) after
~| variable substitution when it evaluates a command. However, this
~| is not the case for "<<" I/O redirection: the variables are passed
~| unfiltered.
~|
Aha! That explains the strange behaviour I got on one system, where
I was trying to use "cu" across a hardwired line, requiring a null
first argument (nothing to dial).
I can type to the shell:
cu "" -s 2400 -l /dev/whatever
but when I put CU='cu "" -s 2400 -l /dev/whatever' in my .profile,
I couldn't get $CU to work, and the error meesage from cu was one
I couldn't reproduce by typing at the screen. No amount of fiddling
with different combinations of quoting chars helped. Musta been those
eighth bits acting up. Yep, it's a bug.
Dave Sherman
Toronto
--
{allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave
or
David_Sherman%Wayne-MTS%UMich-MTS.Mailnet at MIT-Multics.ARPA
More information about the Comp.unix.wizards
mailing list