adds main.sh

This commit is contained in:
2019-05-13 13:44:59 +02:00
parent b5e5b36b64
commit cdf26bc084

60
main.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
inverse="$(tput setab 7)$(tput setaf 0)"
success="$(tput setab 2)$(tput bold)"
error="$(tput setab 1)$(tput bold)"
underline=$(tput smul)
reset=$(tput sgr0)
# Set pipefail option
set -o pipefail
title () {
read title
echo " ****"
echo "***** $title *****"
echo "*****"
}
subtitle () {
read title
echo "***** $title"
}
footer () {
echo "***** *****"
echo "***** END OF SCRIPT *****"
echo " **** ****"
}
section () {
read title
echo ":"
echo ":<*> $title..."
}
result () {
local exit_code=$?
if [ $exit_code -eq 0 ]
then
echo ":<=> $success Ok $reset*****"
else
echo ":<!> $error Error $reset*****"
fi
}
output () {
while read line
do
#[ -z "$line" ] && break
echo ": | $line"
done
}
output::warning () {
while read line
do
echo ":<!> $line"
done
}