adds main.sh
This commit is contained in:
60
main.sh
Normal file
60
main.sh
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user