D&C GLug - Home Page

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

Re: [LUG] Echo command

 

On 10/18/07, John Horne <john.horne@xxxxxxxxxxxxxx> wrote:
> Hi,
>
> 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 '$'?

>>From http://en.opensuse.org/Bash :

A double-quoted string preceded by a dollar sign ($"...") will cause
the string to be translated according to the current locale. If the
current locale is C or POSIX, the dollar sign is ignored. If the
string is translated and replaced, the replacement is double-quoted.

So it means that the string between quotes would be translated to,
say, Cornish if you have set your locale to use Cornish.

Martijn.

-- 
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