Add mare ex .if condition
This commit is contained in:
14
script.sh
14
script.sh
@@ -1,15 +1,15 @@
|
||||
|
||||
#!/bin/bash
|
||||
##1
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ./script.sh $name"
|
||||
exit 1
|
||||
##Daca numarul total de argumente are mai putin de 2 argumente:
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Usage: ./script.sh <first_name> <last_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
name="$1"
|
||||
first_name="$1"
|
||||
last_name="$2"
|
||||
|
||||
echo "Hello, $name!"
|
||||
echo "Welcome to DevOps Bash scripting."
|
||||
echo "Hello, $first_name $last_name!"
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user