printf in bash

Jason Spiro jasonspiro-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Jun 15 18:12:38 UTC 2006


On 6/15/06, Neil Watson <tlug-neil-8agRmHhQ+n2CxnSzwYWP7Q at public.gmane.org> wrote:
> On Thu, Jun 15, 2006 at 08:25:46PM +0300, Peter wrote:
> >plp at plp:~$ cat <<END
> >>This is line two with quotations ""
> >>END
>
> What about quoting the string so that no special characters are
> interpreted?  The eqiuvilant of using single quotes?
>

I don't know if this feature is mentioned in the manpage, but cat
<<'END' seems to work for what you want.

The same thing works with here strings (a new feature in Bash 3.0 that
lets you write one-line here-documents easily. Plus, they go into your
up-arrow history so you can search for them with Ctrl-R etc.)

$ rev <<<"Current directory is $PWD"
r/orips/emoh/ si yrotcerid tnerruC
$ rev <<<'Current directory is $PWD'
DWP$ si yrotcerid tnerruC

Please CC me on all replies.
Regards,
Jason
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list