2009/7/2 Cristian Ionescu-Idbohrn
[...]
>> UNIX SHELL Quote Tutorial
>> Written by Bruce Barnett
>> http://www.grymoire.com/Unix/Quote.html
>>
>> Sh - the Bourne Shell
>> http://www.grymoire.com/Unix/Sh.html
>
> Is this just good advice (thanks for that, by the way)?

You're welcome. But somehow it doesn't work. You have problem of not
understanding, how shell works. This is not a bug in dash.

> Any particular part of the tutorial, you, advertise that offers some sort
> of recipe on to how to solve the problem at hand (read it but did not
> find anything relevant referring to this particular dash bug)?

<http://www.grymoire.com/Unix/Sh.html>:
(optional)* Shell basics
(optional)* Meta-characters and Filename expansion
* Finding the executable
* Quoting with the Bourne Shell
(optional)* Nested quotations
(optional)* Strong versus weak quoting
(optional)* Quoting over several lines
(optional)* Mixing quotation marks
(optional)* Quotes within quotes - take two
(optional)* Placing variables within strings
* Variables
* A subtle point

"Whitespace (spaces, tabs or newlines) terminate the value." Please,
do not confuse 'whitespace' on input (script itself) with 'whitespace'
in the variable. For shell this

>        v="$@"

must be the same as
v=$*
v="$*"
v=$@
because whitespace inside parameters of $* or $@ does not "terminate
the value". Thus no need of quoting of anything, like in case of usual
command processing (* Finding the executable).

So why do you need `v=$*` anyway? Do you understand, that "$@" is
useful only in parameter list *for* a command ('executable' in the
tutorial), so it gets all parameters whitespace-untouched by the
shell?

> I've found a problem with expanding $...@.
> If I declare a local variable and assigns the expanded positional parameters:
>        local v="$@"

Here *is* such case -- a command gets executed with a parameter list
handled by the shell, so goto "* Finding the executable", please, to
find out once again, what it does there.

Finally, find some info about why some shells, but not classic
`/bin/sh` or dash, have `[[` command with some special subtle
functionality, altering "* Finding the executable". Maybe this will
make the point clear.
-- 
sed 'sed && sh + olecom = love'  <<  ''
-o--=O`C
 #oo'L O
<___=E M
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to