Stann
Stann

Reputation: 13968

Why is the $ sign used in this bash script

I'm looking on Fedora sysV init script example and it goes like this:

#...some code
 start() {
    [ -x $exec ] || exit 5
    [ -f $config ] || exit 6
    echo -n $"Starting $prog: "
    # if not running, start it up here, usually something like "daemon $exec"
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}
#...some more code....

What is the reason for first dollar sign in this line, because it seems that script will work perfectly fine without it - will it not?

echo -n $"Starting $prog: "

Upvotes: 4

Views: 255

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799490

$"..." is an extension that allows you to use gettext i18n in bash scripts.

Upvotes: 6

Related Questions