help-bash
[Top][All Lists]
Advanced

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

Re: quote interpretation via vars without eval


From: Koichi Murase
Subject: Re: quote interpretation via vars without eval
Date: Sat, 13 Mar 2021 19:35:31 +0800

2021年3月13日(土) 7:59 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>:
> i was doing declare -p to again modifications, and noticed i can include
> quotes inside the declare settment ( declare [-opts] "$res" )
> where else do the quotes get interpreted, can you write a short list ?

`declare' is a command that takes string arguments [but with an
exception for the array assignments of the form `arr=(...)']. You can
quote them since they are treated as normal arguments. The arguments
of every command are subject to the shell expansions including the
quote removal, but I wouldn't list all the builtin commands here.
Instead, maybe I can list commands that take variable names as
arguments:

- printf -v VAR ...
- unset [-v] VAR
- test -v VAR

(Needless to say, `typeset', `local`, `readonly', `export', and
`alias' receive a form of arguments similar to `declare'.)

By the way, it takes so much time to decipher your English... Can you
at least put a period after a sentence? I initially thought the clause
``where else ...'' describes the previous word ``settment''---though I
think is a typo of statement---and couldn't get the meaning for a long
time. Also, it is nice to capitalize the first word in a sentence.
Also, i -> I, im -> I'm, etc.

> so thats why im looking for alternative ways

Alternative ways to what? Did you mean alternatives to `eval'? If you
want an alternative way to `eval "$varname=..."', I think `printf -v
"$varname" %s '...'' is the one.

--
Koichi



reply via email to

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