Skip to content

Instantly share code, notes, and snippets.

@MikuHatsune39
Created June 3, 2022 23:02
Show Gist options
  • Select an option

  • Save MikuHatsune39/e09decbff2bc9b09243f3ff9ca73912a to your computer and use it in GitHub Desktop.

Select an option

Save MikuHatsune39/e09decbff2bc9b09243f3ff9ca73912a to your computer and use it in GitHub Desktop.
# >NUL 2>NUL & "C:\Program Files\Git\bin\bash.exe" %0 & exit /b
#!/bin/bash
# vvv Just used to clear last line vvv
clear_this_line(){
printf '\r'
cols="$(tput cols)"
for i in $(seq "$cols"); do
printf ' '
done
printf '\r'
}
erase_lines(){
test -z "$1" && lines="1" || lines="$1"
UP='\033[1A'
[ "$lines" = 0 ] && return
if [ "$lines" = 1 ]; then
clear_this_line
else
lines=$((lines-1))
clear_this_line
for i in $(seq "$lines"); do
printf "$UP"
clear_this_line
done
fi
}
erase_lines 3
# ^^^ Remove if you want ^^^
# Your Bash Script Here
printf $PATH # Example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment