Reputation: 105
I have a script listening for a user input like that.
read -p "Run? (y/[n]) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
[..]
fi
Is there a way (upon executing the script) to already send the value which read is going to read and handle?
Upvotes: 0
Views: 44
Reputation: 105
your_script.sh <<< "Y"
This also supports multiple read
's
your_script.sh <<< "YNYYNNY"
Upvotes: 2