Skip to content

Instantly share code, notes, and snippets.

@xxjapp
Last active December 14, 2015 14:29
Show Gist options
  • Save xxjapp/5101138 to your computer and use it in GitHub Desktop.
Save xxjapp/5101138 to your computer and use it in GitHub Desktop.
Use only one line eithor in bash script file or command line to display a digital clock. This line also shows some useful tricks in bash script
# Use only one line eithor in bash script file or command line to display a digital clock.
# This line also shows in bash script
# - A example of endless loop
# - Assigning output of command to a variable
# - "-n" "-e" of echo command
# - "\r" is used to reset the current line output
while sleep 1; do o=$(date); echo -n -e "\r$o"; done
@xxjapp
Copy link
Author

xxjapp commented Jul 19, 2013

monitor last file information

while sleep 1; do o=$(ll | tail -1); echo -n -e "\r$o"; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment