public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Problems with 'expr'
@ 2000-09-21  7:01 Andre Bleau
  0 siblings, 0 replies; 4+ messages in thread
From: Andre Bleau @ 2000-09-21  7:01 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

>  Hi,
>
>  I tried to use 'expr'. And it worked fine for this
>'expr 1 + 2 + 3'. But if I try to use '(' or '*' it
>will print 'expr: syntax error'. Shouldn't the
>following work? 'expr 3 * 4'?
>
>  Jens Yllman

The correct syntax is:
expr 3 \* 4
or
expr 3 '*' 4
same thing for ( or ).


André Bleau, ing., analyste
email: bleau at courriel dot polymtl dot ca
(Fight SPAM: encode your email-address)

Département de génie électrique et         Electric Engineering and
de génie informatique                      Computer Engineering department
École Polytechnique de Montréal            Montreal Polytechnic School


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Problems with 'expr'
@ 2000-09-21  7:24 jens
  0 siblings, 0 replies; 4+ messages in thread
From: jens @ 2000-09-21  7:24 UTC (permalink / raw)
  To: cygwin

 Hi,

 Silly me. How could I forgett/miss that. It's just
that expr is not something I normaly use. So I did
not think of that when I tried it out.

 Thanks.

 Jens Yllman

>Hi Jens,
>
>Use quotes around * and (, like
>
>expr 3 '*' 4
>
>Otherwise bash will expand * to all the files in the current dir.
>( has special meaning to bash, too.
>
>expr '3 * 4'
>
>on the other hand, is evaluated to the string "3 * 4"
>
>See bash's manpage.
>
>Karsten
>
>> -----Original Message-----
>> From: jens@uniweb.se [ mailto:jens@uniweb.se ]
>> Sent: Donnerstag, 21. September 2000 14:32
>> To: cygwin@sources.redhat.com
>> Subject: Problems with 'expr'
>> 
>> 
>>  Hi,
>> 
>>  I tried to use 'expr'. And it worked fine for this
>> 'expr 1 + 2 + 3'. But if I try to use '(' or '*' it
>> will print 'expr: syntax error'. Shouldn't the
>> following work? 'expr 3 * 4'?
>> 
>>  Jens Yllman
>> 
>> --
>> Want to unsubscribe from this list?
>> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
>> 
>> 
>

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Problems with 'expr'
@ 2000-09-21  6:53 Fleischer, Karsten (K.)
  0 siblings, 0 replies; 4+ messages in thread
From: Fleischer, Karsten (K.) @ 2000-09-21  6:53 UTC (permalink / raw)
  To: 'jens@uniweb.se'; +Cc: Cygwin (E-mail)

Hi Jens,

Use quotes around * and (, like

expr 3 '*' 4

Otherwise bash will expand * to all the files in the current dir.
( has special meaning to bash, too.

expr '3 * 4'

on the other hand, is evaluated to the string "3 * 4"

See bash's manpage.

Karsten

> -----Original Message-----
> From: jens@uniweb.se [ mailto:jens@uniweb.se ]
> Sent: Donnerstag, 21. September 2000 14:32
> To: cygwin@sources.redhat.com
> Subject: Problems with 'expr'
> 
> 
>  Hi,
> 
>  I tried to use 'expr'. And it worked fine for this
> 'expr 1 + 2 + 3'. But if I try to use '(' or '*' it
> will print 'expr: syntax error'. Shouldn't the
> following work? 'expr 3 * 4'?
> 
>  Jens Yllman
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
> 
> 

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Problems with 'expr'
@ 2000-09-21  6:35 jens
  0 siblings, 0 replies; 4+ messages in thread
From: jens @ 2000-09-21  6:35 UTC (permalink / raw)
  To: cygwin

 Hi,

 I tried to use 'expr'. And it worked fine for this
'expr 1 + 2 + 3'. But if I try to use '(' or '*' it
will print 'expr: syntax error'. Shouldn't the
following work? 'expr 3 * 4'?

 Jens Yllman

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-09-21  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-21  7:01 Problems with 'expr' Andre Bleau
  -- strict thread matches above, loose matches on Subject: below --
2000-09-21  7:24 jens
2000-09-21  6:53 Fleischer, Karsten (K.)
2000-09-21  6:35 jens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).