Next time you want to say
  $ echo "This is fun!"

What you probably want is 

  $ echo 'This is fun!'

or even 

  $ echo this is fun\!



That's because double-quotes delimit a string, but they still allow the
shell to expand the contents. The shell wants to replace a ! in
plain-view with a history event. A single quote doesn't allow shell
expansion.

  

Martin Visser, CISSP
Network and Security Consultant 
Consulting & Integration
Technology Solutions Group - HP Services

410 Concord Road
Rhodes NSW  2138
Australia 

Mobile: +61-411-254-513
Fax: +61-2-9022-1800     
E-mail: martin.visserAThp.com

This email (including any attachments) is intended only for the use of
the individual or entity named above and may contain information that is
confidential, proprietary or privileged. If you are not the intended
recipient, please notify HP immediately by return email and then delete
the email, destroy any printed copy and do not disclose or use the
information in it.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Rick Welykochy
Sent: Monday, 23 May 2005 6:57 PM
To: Glen Turner
Cc: SLUG
Subject: Re: [SLUG] recursive tree log grep ?

Glen Turner wrote:

> In a real-world script you might also say
>   "${dir}"
> rather than
>   $dir
> to allow nasty filenames.

Does "${dir}" buy you any more safety than "$dir" ??
I thought not.

Also, a side question: how come 'events' and exclamation marks cause
havoc in bash, in seemingly innocent situations:

   $ echo "This is fun!"
   -bash: !": event not found


cheers
rickw


--
_________________________________
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either
being made.
      -- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to