[comp.unix.wizards] Cshell Anomaly

martin@mqcomp.oz (Martin Foord) (12/02/88)

How does one get an asterisk '*' in a csh variable ?   I've been trying for
a long time to figure this one out but can't achieve it ?  What about if
you're reading chars in from a file into csh variables and one of them is a
'*' it doesn't appear into the csh variable at all !

							maf.
--------------------------------------------------------------------------------
Martin Foord              ACSnet,Ean,CSnet: martin@mqcomp.mq.oz
Computing Discipline      Arpa:  martin%mqcomp.mq.oz@UUNET.UU.NET
Macquarie University 2109 Janet: martin%mqcomp.mq.oz@UK.AC.UKC
Australia                 UUCP:  {uunet,mcvax}!munnari!mqcomp.mq.oz!martin
D

ok@quintus.uucp (Richard A. O'Keefe) (12/06/88)

In article <599@mqcomp.oz> martin@mqcomp.oz (Martin Foord) writes:
>How does one get an asterisk '*' in a csh variable ?
	set x=\*
	set x="*"
	set x='*'
	set x=$<
	*
All work.  To verify this, try
	echo "$x"
after each one.  _Don't_ try
	echo $x
as filename generation is done after variable substitution.
(Tested in DYNIX 4.2BSD, SunOS3.2, System V.3/386.)

dce@mips.COM (David Elliott) (12/06/88)

In article <815@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>In article <599@mqcomp.oz> martin@mqcomp.oz (Martin Foord) writes:
>>How does one get an asterisk '*' in a csh variable ?
>	set x=\*
...
>All work.  To verify this, try
>	echo "$x"
>after each one.  _Don't_ try
>	echo $x
>as filename generation is done after variable substitution.

Another way to get the value out is

	set

(no arguments).  This prints the values of all shell variables
without doing any kinds of substitution.

-- 
David Elliott		dce@mips.com  or  {ames,prls,pyramid,decwrl}!mips!dce
"Did you see his eyes?  Did you see his crazy eyes?" -- Iggy (who else?)

maart@cs.vu.nl (Maarten Litmaath) (12/06/88)

martin@mqcomp.oz (Martin Foord) writes:

\How does one get an asterisk '*' in a csh variable ?   I've been trying for
\a long time to figure this one out but can't achieve it ?  What about if
\you're reading chars in from a file into csh variables and one of them is a
\'*' it doesn't appear into the csh variable at all !

Because it has to be escaped.

	% set x=\*
	% echo "$x"
	*
	%
-- 
fcntl(fd, F_SETFL, FNDELAY):          |Maarten Litmaath @ VU Amsterdam:
      let's go weepin' in the corner! |maart@cs.vu.nl, mcvax!botter!maart