Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ printf "abc" > some-file
- $ cat some-file
- abc$
- # injects the arguments into the terminal, from the second link
- function inject() {
- perl -e 'ioctl(STDIN, 0x5412, $_) for split "", join " ", @ARGV' "$@"
- }
- # prints a newline if the cursor is not in position 1
- clear_newline() {
- local curpos # local variable to hold the cursor position
- local input # local variable to hold entered input
- stty -echo # disable echoing
- inject '
- ' # inject a newline to terminate entered input, '