How can I send a keystroke like 'q' to a script that ends with a call to less?
test.sh
ls -l | lessIf I call test.sh it hangs and waits for the user type 'q'. How can I do something like this:
echo 'q' | test.shAnd have the script exit?
21 Answer
You can do this, which still have less page the output, but it will exit when it hits eof.
LESS=-E ./test.shor
./test.sh | catwhich just dumps the output to the screen.