For instance by validating input parameters
Arrays are a great and simple way to achieve this.
array=(pippo pluto topolino)
printf '%s ' "${array[@]}"
printf '\n'
value=puppo
if [[ ! " ${array[@]} " =~ " ${value} " ]]; then
echo "array doesnt contain value $value"
fi
No comments:
Post a Comment