help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] avoiding shell variable expansion


From: Dmitry Alexandrov
Subject: Re: [Help-bash] avoiding shell variable expansion
Date: Fri, 04 Oct 2019 06:43:18 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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 '*'

Attachment: signature.asc
Description: PGP signature


reply via email to

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