{"id":323,"date":"2009-05-01T09:51:12","date_gmt":"2009-05-01T17:51:12","guid":{"rendered":"http:\/\/xiehang.com\/blog\/?p=323"},"modified":"2009-05-02T20:24:54","modified_gmt":"2009-05-03T04:24:54","slug":"read-for-shell","status":"publish","type":"post","link":"https:\/\/xiehang.com\/blog\/2009\/05\/01\/read-for-shell\/","title":{"rendered":"read for shell"},"content":{"rendered":"

Just want to write this done so that I don’t have to man again in the future:<\/p>\n

CC=; while [ 1 ] ; do read -s -t 1 -n 1 CC; if [ “$CC” = ‘q’ ] ; then break; fi; clear; ls -als crtv_* | tail -15 ; done<\/p>\n

-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.<\/p>\n

Pretty usefule, actually this can be used to do some interact applications with shell.<\/p>\n","protected":false},"excerpt":{"rendered":"

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 […]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9,8],"_links":{"self":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/323"}],"collection":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":5,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/323\/revisions"}],"predecessor-version":[{"id":325,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/323\/revisions\/325"}],"wp:attachment":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/categories?post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/tags?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}