[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] need help running a command from a bash script
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] need help running a command from a bash script |
Date: |
Mon, 8 Aug 2016 16:48:57 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Mon, Aug 08, 2016 at 01:03:33PM -0700, Wood Peter wrote:
> mycommand --option "var date1='2016-01-01T04:00:00.000Z',
> date2='2016-08-08T04:00:00.000Z'"
>
> I'd like to run this from a bash script where the date will be a variable:
mycommand --option "var date1='$datevariable', date2='$otherdatevar'"
> mycommand --option "var date1=$date1value,date2=$date2value"
>
> The above is not working because the single quotes are missing i.e.
So put them back in.
> Also I can't do date1='$date1value' either because $ can't be inside the
> sigle quotes.
But it's NOT inside single quotes. It's inside double quotes.
mycommand --option "var date1='$datevariable', date2='$otherdatevar'"
There are DOUBLE quotes around the whole thing. So the single quotes
inside them are just characters that are part of the argument (not
acting as quotes), and the parameter expansions are expanded.