Add if/else conditions

This commit is contained in:
2025-12-14 19:49:15 +00:00
parent 777b6b567d
commit 08eba2eccc

View File

@@ -1,5 +1,40 @@
#!/bin/bash
##1
if [ -z "$1" ]; then
echo "Usage: ./script.sh <name>"
exit 1
fi
name="$1"
echo "Hello, $name!"
echo "Welcome to DevOps Bash scripting."
##2
if [-z "$1"]; then
echo "Usage: ./script.sh <name>"
exit 1
fi
name="$1"
if ["$name == "Liana"]; then
echo "Hello $name! You ar awesome!"
else
echo "Hello, $name!"
fi
exit 0
name="Liana"
course="DevOps Bash"