[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] pass command to script
From: |
Tim Visher |
Subject: |
Re: [Help-bash] pass command to script |
Date: |
Thu, 25 Apr 2019 13:35:59 -0400 |
On Thu, Apr 25, 2019 at 11:49 AM Christof Warlich <address@hidden> wrote:
> I want my script to execute any command being passed as command-line
> arguments. As a non-trivial example, consider the following command:
>
> $ var="Hello cruel" bash -c 'echo "${var} world!"; sleep 2; echo
> "Goodbye Worlrld!"'
> Hello cruel world!
> Goodbye World!
>
> Thus, I would like that
>
> $ ./myscript var="Hello cruel" bash -c 'echo "${var} world!"; sleep 2;
> echo "Goodbye World!"'
> initial work
> Hello cruel world!
> Goodbye World!
> final work
>
> does some initial work, runs the command beingg passed and then again
> does some final work.
>
Some or all of https://mywiki.wooledge.org/BashFAQ/050 should be relevant
to you.