D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Echo command

 

On Thu, Oct 18, 2007 at 03:56:42PM +0100, John Horne wrote:
> Running Fedora 7, I noticed that many of the system startup scripts
> (in /etc/init.d) use the 'echo' command with a preceeding '$' character.
> The scripts use bash. For example in sshd it uses:
> 
>     echo -n $"Generating SSH1 RSA host key: "
> 
> A little testing seems to show that it does nothing - i.e. echo does not
> display it. It does not seem to matter if I use the external command
> '/bin/echo' or let it use the shell builtin 'echo' command.
> 
> So what is the point of the '$'? 

Could it be some kind of compatibility thing? bash doesn't print
the $, but dash and zsh do, and (from memory) csh/tcsh would give
an error and not print anything.

(Actually, whether zsh prints the $ depends on whether it's followed
by single or double quotes.)

-- 
Benjamin A'Lee <bma@xxxxxxxxxxxxxx>
http://subvert.org.uk/~bma/
"I like your Christ, I do not like your Christians. Your Christians are
so unlike your Christ." - Mahatma Gandhi

Attachment: pgpjXnA1BFvDt.pgp
Description: PGP signature

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html