help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] How pass arguments to a command run by the -c option of


From: Chris Down
Subject: Re: [Help-bash] How pass arguments to a command run by the -c option of bash?
Date: Sun, 21 Jul 2013 18:11:18 +0200

On 21 July 2013 18:01, Peng Yu <address@hidden> wrote:
> I'm trying to run a command by the -c option. But 'a' is not passed to
> address@hidden Does anybody know what is correct way to pass the command
> arguments to a command run by the -c option of bash?

    $ bash -c 'echo "$0" "$@"' a b c
    a b c

$0 is not part of address@hidden From the man page:

> If the -c option is present, then commands are read from string.  If there 
> are arguments after the string, they are assigned to the positional 
> parameters, starting with $0.

Best,

Chris



reply via email to

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