I just wanted to write a small sript for copying some files for my NAS, so I'm not very experienced in Shell-Scripting. I know that many command line tools on Linux use the following sheme for Yes/No inputs
Are you yure [Y/n]
where the capitalized letter indicates the standard action which would also be started by hitting Enter. Which is nice for a quick usage.
I also want to implement something like this, but I have some trouble with caching the Enter key. Here is what I got so far:
read -p "Are you sure? [Y/n] " response
case $response in [yY][eE][sS]|[yY]|[jJ]|[#insert ENTER codition here#])
echo
echo files will be moved
echo
;;
*)
echo
echo canceld
echo
;;
esac
I can add what ever I want but it just won't work with Enter.