Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

escaping the question mark char in csh/tcsh

362 views
Skip to first unread message

James Bray

unread,
Feb 15, 2008, 5:58:32 AM2/15/08
to
Hi,

Can anyone help me with a most frustrating problem.

I cant seem to find a way to embed a literal question mark (?)
character in a csh/tcsh variable.

> set test="Hello?World"
> echo $test

simply results in

echo: No match.

because it is trying to do some kind of file substitution.

I've tried escaping and using single and double quote combinations,
but to no avail.

Any help would be much appreciated....

Cheers,

James Bray

Stephane Chazelas

unread,
Feb 15, 2008, 6:05:01 AM2/15/08
to
On Fri, 15 Feb 2008 02:58:32 -0800 (PST), James Bray wrote:
[...]
[...]

Try:

echo "$test"

echo $test:q

You may also want to switch to zsh ;)

--
Stephane

James Bray

unread,
Feb 15, 2008, 9:39:28 AM2/15/08
to
On 15 Feb, 11:05, Stephane Chazelas <stephane_chaze...@yahoo.fr>
wrote:

Thanks for that Stephanie, I think that should do nicely :-)

And no, no chance of moving to zsh (Windows Interix system)

Cheers,

James

Glenn Jackman

unread,
Feb 15, 2008, 10:08:07 AM2/15/08
to
At 2008-02-15 09:39AM, "James Bray" wrote:
> On 15 Feb, 11:05, Stephane Chazelas <stephane_chaze...@yahoo.fr>
> wrote:
[...]
> > --
> > Stephane
>
> Thanks for that Stephanie, [...]

Can I get this off my chest? The above is a real pet peeve of mine.
Names are important, people.

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

Spiros Bousbouras

unread,
Feb 15, 2008, 11:18:36 AM2/15/08
to
On Feb 15, 10:58 am, James Bray <james_b...@yahoo.com> wrote:
> Hi,
>
> Can anyone help me with a most frustrating problem.
>
> I cant seem to find a way to embed a literal question mark (?)
> character in a csh/tcsh variable.
>
> > set test="Hello?World"
> > echo $test
>
> simply results in
>
> echo: No match.
>
> because it is trying to do some kind of file substitution.
>
> I've tried escaping and using single and double quote combinations,
> but to no avail.

Here are several ways to do it:

prompt> set r = 'rtg?234'
prompt> echo "$r"
rtg?234
prompt> set r = "rtg?234"
prompt> echo "$r"
rtg?234
prompt> set b = "???${r}gfg$r"
prompt> echo "$b"
???rtg?234gfgrtg?234

Spiros Bousbouras

unread,
Feb 15, 2008, 11:21:31 AM2/15/08
to
On Feb 15, 3:08 pm, Glenn Jackman <gle...@ncf.ca> wrote:
> At 2008-02-15 09:39AM, "James Bray" wrote:
>
> >  On 15 Feb, 11:05, Stephane Chazelas <stephane_chaze...@yahoo.fr>
> >  wrote:
> [...]
> > > --
> > > Stephane
>
> >  Thanks for that Stephanie, [...]
>
> Can I get this off my chest?  The above is a real pet peeve of mine.

Mine too. Stephanie should stick to her kitchen
and stop posting on comp.unix.shell

:-D

Maxwell Lol

unread,
Feb 15, 2008, 1:08:01 PM2/15/08
to
Glenn Jackman <gle...@ncf.ca> writes:

> At 2008-02-15 09:39AM, "James Bray" wrote:
> > On 15 Feb, 11:05, Stephane Chazelas <stephane_chaze...@yahoo.fr>
> > wrote:
> [...]
> > > --
> > > Stephane
> >
> > Thanks for that Stephanie, [...]
>
> Can I get this off my chest? The above is a real pet peeve of mine.
> Names are important, people.

As are genders.
p.s. Stephane's home page (and picture) is on
http://stephane.chazelas.free.fr/

James Bray

unread,
Feb 15, 2008, 3:01:23 PM2/15/08
to

Well, my apologies Stephane... twas a bit of a lame mistake....

And as far as you Glinn, well, we're not all perfect you know....

0 new messages