tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ shell expansion inside crontab

Upper and Lower case in SED?? ▻

replacing space with underscore

In article <7lgu95$4n5a$1@newssvr04-int.news.prodigy.com>,
John McKown <joarmc@prodigy.net> wrote:
>I just tried this and got the same results - no translation. But the man
>page says that \ooo will use octal. A bug in tr? A bug in the doc? NO!

No, `tr' has to see the backwhacks.  Most shells use backwhacks to quote
the next character, so the command doesn't see them.

    $ echo \foo
    foo

By applying another level of quoting, the backwhack is stripped of its
special meaning, and passed to the command.

    $ echo '\foo'
    \foo

You could equally well use backwhack or double quoting here.

    $ echo \\foo "\bar"
    \foo \bar

(Note that I'm assuming a non-System V echo.)

>SUCCESS! It would have been very nice for the man page to say this
>outright.

The manual pages tend to assume that you know what your shell is doing,
so don't discuss quoting or globbing, for instance.  They are really
reference documentation, not tutorials.

Tim.
--
Tim Goodwin   | "You don't need to do drugs in order to
University of | think that the government's policies are
Leicester, UK | stupid and dangerous." -- David Bancroft

Original headers:

From: tjg@ltpcg.star.le.ac.uk (Tim J Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: replacing space with underscore
Date: 2 Jul 1999 11:49:57 +0100
Organization: University of Leicester, UK
Message-ID: <7li5gl$1ke$1@ltpcg.star.le.ac.uk>
References: <7lgl7c$99a$1@ultra.sonic.net>
  <7lgu95$4n5a$1@newssvr04-int.news.prodigy.com>

△ comp.unix.shell △

◅ shell expansion inside crontab

Upper and Lower case in SED?? ▻