[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quote interpretation via vars without eval
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: quote interpretation via vars without eval |
Date: |
Sat, 13 Mar 2021 16:02:35 +0100 |
well, i cannot
this is my text i do as i can
tried to type a period after my small short sentenses, made me no sense..
im sorry
.. i dont plan on obfuscating, neither code nor mail text, or insult, or
so, its just me and so it is
i had many such advices, about oudated wrong formatting rules
is no good
assume newline be the dot, or at least an important meaning separator
there is also misunderstanding totally
settment i meant, by set-ing
also you misunderstood my quotes question
it was related to internal parsing of bash of strings
not arguments
i set declare [-opts] "$var" where $var is complex array stuff
and i noticed, cause i format $var by declare -p output
so to summarize, i have one string, with quotes data inside, which declare
"$var" parses right
my question is, where else this behavior
i dont look for arguments, im looking for quote interpretation by flat
strings, eg when needing to do eval to make em interpreted
declare "$complex" obvisously parses them right, " quotes as also $'
.. question .. which other builtins would interpret $complex quote-right
i suppose declare would also parse ' and \ right but i didnt try
cmd='a "complex command"' ; eval "$cmd"
is needed to interpret the quotes
i dont need it much for commands, more for safe variable assignments ( i
learnt some lessions about how eval can explode and wrong code can harm )
thank you for your input
On Sat, Mar 13, 2021 at 12:35 PM Koichi Murase <myoga.murase@gmail.com>
wrote:
> 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
>
- quote interpretation via vars without eval, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: quote interpretation via vars without eval, Koichi Murase, 2021/03/13
- Re: quote interpretation via vars without eval,
Alex fxmbsw7 Ratchev <=
- Re: quote interpretation via vars without eval, Koichi Murase, 2021/03/13
- Re: quote interpretation via vars without eval, Alex fxmbsw7 Ratchev, 2021/03/13
- Re: quote interpretation via vars without eval, Alex fxmbsw7 Ratchev, 2021/03/14
- Re: quote interpretation via vars without eval, Koichi Murase, 2021/03/14
- Re: quote interpretation via vars without eval, Alex fxmbsw7 Ratchev, 2021/03/14
- Re: quote interpretation via vars without eval, Koichi Murase, 2021/03/15
- Re: quote interpretation via vars without eval, Alex fxmbsw7 Ratchev, 2021/03/15
- Re: quote interpretation via vars without eval, Greg Wooledge, 2021/03/15