0

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).

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

It's in the Invoking Bash section of the manual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.