Created
October 13, 2016 00:31
-
-
Save BrainStone/484b2a7d9f1f9d635eeea14ea89b7d9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Force bash | |
if [ -z "$BASH" ] || [ ! "_$BASH" = "_/bin/bash" ];then bash $0 "$@";exit;fi | |
GET_CURRENT_ROW() | |
{ | |
exec < /dev/tty | |
oldstty=$(stty -g) | |
stty raw -echo min 0 | |
echo -ne "\e[6n" > /dev/tty | |
IFS=';' read -r -d R -a pos | |
stty "$oldstty" | |
echo ${pos[0]:2} | |
} | |
MAKE_WINDOW() | |
{ | |
lines=10 | |
if [[ "$1r" == -* ]] | |
then | |
if [[ ${1:1} =~ ^[0-9]+$ ]] | |
then | |
lines=${1:1} | |
shift | |
fi | |
fi | |
for (( i = -2; i < $lines ; i++ )) | |
do | |
echo | |
done | |
row=$(GET_CURRENT_ROW) | |
startrow=$(((row - 1) - lines)) | |
echo -en "\e["$startrow";"$((row - 1))"r\e["$startrow"H" | |
"$@" | |
row=$(($(GET_CURRENT_ROW) + 1)) | |
echo -en "\e[r\e["$row"H" | |
} | |
echo -en "\a" | |
figlet -t -f smslant -k " apt-get update" | |
MAKE_WINDOW -15 apt-get update | |
echo -en "\a" | |
figlet -t -f smslant -k " apt-get dist-upgrade" | |
MAKE_WINDOW -20 apt-get dist-upgrade | |
echo -en "\a" | |
figlet -t -f smslant -k " apt-get autoremove" | |
MAKE_WINDOW apt-get autoremove | |
echo -en "\a" | |
figlet -t -f smslant -k " apt-get autoclean" | |
MAKE_WINDOW apt-get autoclean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment