Created
January 16, 2019 03:47
-
-
Save Omie/aa79990e72d580e211a2a78c1b545630 to your computer and use it in GitHub Desktop.
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 characters
#!/bin/bash | |
echo "Magic!" echo -en "\033[1F\033[2K" echo "Moar Magic!" | |
#This script will print "Magic!" then the next echo sends escape sequences that move the cursor up 1 line with '\033[1F', then '\033[2K' clears the line the cursor is on, which is now the "Magic!" line. Then we output "Moar Magic". 3 commands but only one line of output. | |
#The -e option on echo enables the escape sequences instead of literal chars. -n disables echos automatic newline for the sequence that deletes the first line | |
# https://news.ycombinator.com/item?id=18915489 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment