4 Answers
- Have a shebang defining /bin/bash as the first line of your sayhello.sh, so your file sayhello.sh will begin with bin/sh #!/bin/sh.
- Install Bash in your Alpine image, as you seem to expect Bash is present, with such a line in your Dockerfile: RUN apk add --no-cache --upgrade bash.
Moreover, how do I run a bash script?
The procedure to run the .sh file shell script on Linux is as follows:
- Set execute permission on your script: chmod +x script-name-here.sh.
- To run your script, enter: ./script-name-here.sh. Another option is as follows to execute shell script: sh script-name-here.sh. OR bash script-name-here.sh.
Beside above, does Alpine come with bash? There is no Bash installed by default; Alpine uses BusyBox Bash as the default shell.
In this regard, how do I run a bash script in parallel?
To run script in parallel in bash, you must send individual scripts to background. So the loop will not wait for the last process to exit and will immediately process all the scripts.
How do I run a bash script from a folder?
To run executable from any directory:
- Make a bin directory under your home directory and mv your executable scripts into it.
- Move your executable scripts in bin direcoty.
- Now add it to your path variable.
- Check if that path is added in path variable.
- Verify if script is running from any random directory.