I have written a very simple shell script ("test.sh") and put it into a container. I can see it using "> ls" in the Docker terminal. and its contents using "> more" However, when I type "> ./test.sh" I get
/bin/sh: ./test.sh: not found
Here is the output for ls -l (I am operating as "user")
-rwxrwxrwx 1 user group 327 Mar 24 14:14 test.sh
What am I doing wrong?
Additional information. Here is a minimal example:
#!/bin/sh
var=$1
echo $var
The solution is to add "sh" in front of the command
sh test.sh testMessage
gives back
testMessage
Additional note: Thanks to @David Maze.
I changed
#!/bin/bash
to
#!/bin/sh
The solution is to add "sh" in front of the command
sh test.sh testMessage
gives back
testMessage