mirandalol
mirandalol

Reputation: 465

Bash read arguments as commands

I want to do something like this:

C:\cygwin\bin\bash --some-switch date "+%Y-%m-%d %H:%M:%S" >> unit-tests-runs.log

Everything after bash is basically treated as if I'm in the shell.

Upvotes: 0

Views: 77

Answers (1)

Todd A. Jacobs
Todd A. Jacobs

Reputation: 84343

The -c Flag

You need the -c flag and some quotes. For example:

$ bash -c 'date "+%Y-%m-%d %H:%M:%S" >> unit-tests-runs.log'

Upvotes: 1

Related Questions