read for shell

Just want to write this done so that I don’t have to man again in the future:

CC=; while [ 1 ] ; do read -s -t 1 -n 1 CC; if [ "$CC" = 'q' ] ; then break; fi; clear; ls -als crtv_* | tail -15 ; done

-s is “don’t echo”, -t 1 is “timeout after 1 second”, -n 1 is “read one character only” (so don’t have to wait for enter.

Pretty usefule, actually this can be used to do some interact applications with shell.

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

WordPress Themes