The shell script
Create a simple shell script to print a greeting.
The script will print Hello
and the name supplied as the script’s first
argument (defaulting to World
if none).
#!/bin/sh
NAME=${1:-world}
echo "Hello, $NAME!"
Set the executable bit and run the script in your terminal.
chmod +x hello.sh
hello.sh
Hello, world!
Try the script passing a name as an argument.
hello.sh Docker
Hello, Docker!
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.