help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does quote removal work with alternative forms of parameter expa


From: Philippe Cerfon
Subject: Re: How does quote removal work with alternative forms of parameter expansion?
Date: Sun, 26 May 2024 18:34:27 +0200

On Sun, May 26, 2024 at 6:18 PM Philippe Cerfon <philcerf@gmail.com> wrote:
> But now, using one of the :- :+ etc forms:
>      x            |   invocation    |   output
> x="${1:-$bar}"    |  bash x.sh ""   |   expanded
> x="${1:-"$bar"}"  |  bash x.sh ""   |   expanded
> x="${1:-'$bar'}"  |  bash x.sh ""   |   'expanded'  => why not quote
> removal, why expansion?
> x="${1:-$'$bar'}" |  bash x.sh ""   |   expanded    => why expansion?
> x="${1:-\$bar}"   |  bash x.sh ""   |   $bar


> x=${1:-$bar}"     |  bash x.sh ""   |   expanded
> x="${1:-"$bar"}   |  bash x.sh ""   |   expanded

Those two should have been without the lone outer ", that is:
x=${1:-$bar}     |  bash x.sh ""   |   expanded
x=${1:-"$bar"}   |  bash x.sh ""   |   expanded

> x=${1:-'$bar'}    |  bash x.sh ""   |   $bar
> x=${1:-$'$bar'}   |  bash x.sh ""   |   $bar
> x=${1:-\$bar}     |  bash x.sh ""   |   $bar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]