Created
October 13, 2016 00:31
Revisions
-
BrainStone created this gist
Oct 13, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,62 @@ #!/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