Skip to main content

Bash

Snippets

echo -n "Enter:"

Change directory to scripts directory

cd $( dirname -- "$0"; )

Prompt for user input

echo -n Enter:
read host_to_deploy
echo "You entered '$host_to_deploy'"

If value is not in list

if [[ " $hosts_to_select_from " =~ .*\ $host_to_deploy\ .* ]]; then
...
fi
current_files=$(ls)
for file in ${current_files[@]}
do
echo " - ${file}"
done