[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] avoiding shell variable expansion
From: |
Eli Schwartz |
Subject: |
Re: [Help-bash] avoiding shell variable expansion |
Date: |
Fri, 4 Oct 2019 00:32:45 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
On 10/3/19 11:43 PM, Dmitry Alexandrov wrote:
> Andy Chu <address@hidden> wrote:
>> On Thu, Oct 3, 2019 at 3:07 PM Greg Silverman <address@hidden>
>> wrote:
>>> In Python one can spawn a child process and avoid bash expanding command
>>> line arguments, e.g.
>>>
>>> //file: ls.py import subprocess proc =
>>> subprocess.Popen(['/bin/ls','*'],shell=False)
>>
>> Simplest way:
>> $ mycmd=(ls '*')
>> $ "${mycmd[@]}"
>> ls: cannot access '*': No such file or directory
>
> Why the array? ¿Is not this exactly the same as:
>
> $ ls '*'
I have a sneaking suspicion the array was just an excuse to
misunderstand the problem domain and advertise some boutique alternative
interactive shell as a solution.
Notice how it suddenly became an entry point to stating that the
recommended sequence of characters (otherwise known as "how to access an
array") must be "memorized or copy-pasted", despite being offtopic and
orthogonal to the problem domain... and then that in turn became an
entry point to some blog post about how POSIX shell syntax sucks and is
too verbose and therefore use this alternative shell.
Aside: the article in question cleverly counts the same 5 things, 3
times each (and ignores the fact that 3 of those things, you are simply
supposed to pretend don't exist -- and the 4th is simply using the wrong
syntax to access an incorrect datatype -- which is a very effective way
of solving confusion) in order to make things sound more complicated
than they really are.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
- [Help-bash] avoiding shell variable expansion, Greg Silverman, 2019/10/03
- Re: [Help-bash] avoiding shell variable expansion, Andy Chu, 2019/10/03
- Re: [Help-bash] avoiding shell variable expansion, Dmitry Alexandrov, 2019/10/03
- Re: [Help-bash] avoiding shell variable expansion,
Eli Schwartz <=
- Re: [Help-bash] avoiding shell variable expansion, Andy Chu, 2019/10/04
- Re: [Help-bash] avoiding shell variable expansion, Andy Chu, 2019/10/04
- Re: [Help-bash] avoiding shell variable expansion, Dmitry Alexandrov, 2019/10/04
- Re: [Help-bash] avoiding shell variable expansion, Andy Chu, 2019/10/04
- Re: [Help-bash] avoiding shell variable expansion, Eli Schwartz, 2019/10/04
Re: [Help-bash] avoiding shell variable expansion, Eli Schwartz, 2019/10/04
Re: [Help-bash] avoiding shell variable expansion, Andreas Kusalananda Kähäri, 2019/10/04
Re: [Help-bash] avoiding shell variable expansion, Stephane Chazelas, 2019/10/04
Re: [Help-bash] avoiding shell variable expansion, Stephane Chazelas, 2019/10/04