Files
bash-programming-from-scratch/manuscript/resources/code/BashScripting/for-exit.sh
2020-10-17 10:22:39 +02:00

15 lines
291 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
array=(Alice Bob Eve Mallory)
for element in "${array[@]}"
do
if [[ "$element" == "$1" ]]
then
echo "Элемент со значением $1 есть в массиве"
exit 0
fi
done
echo "Элемента со значением $1 нет в массиве"