I have a script that is misbehaving and I am at a loss as to why.
#!/bin/bash
while read -r;do
read -rsn1 inp
if ["$inp" = "a"]; then
echo "$REPLY"
fi
done
This returns:
./some.sh: line 4: [a: command not found
The goal of this script is to return a line from the read in the beginning of the while loop whenever any key is pressed once. Obviously it does not currently do that. I know understand the errors I made in my if
statement and am seeking help with accepting a single user keypress and then echo
ing a line from "$REPLY"
. Any help is appreciated.