Ella Jameson
Ella Jameson

Reputation: 638

Pass command text to `bash` from `sh` without a script file?

I am trying to run a single command using bash in a sh script. There is no way to use bash for the script, I have to use sh. However, I need to run a bash-only command in sh.

Basically, I want something like the following:

bash --command_in "echo foobar"

Is this possible? I don't want to make a second script file just to run that one command in bash (like bash my_script.bash).

Upvotes: 0

Views: 58

Answers (1)

Ella Jameson
Ella Jameson

Reputation: 638

Derp, it's the -c flag. This wasn't easy to Google, and the --help is prety brief.

Upvotes: 1

Related Questions