bash-numpad-input
bash-numpad-input copied to clipboard
Greatly improve script
- Converted all "echo" commands to "printf"
- Use
[[ CONDITION ]] && doSomething
instead ofif [ CONDITION ];then doSomething
- Use Regex to check if input is number (
$inpIsNum
) - Check if folder
numpadInput
exists in current directory, so it won't give an error if it does not - Fix syntax:
from
while true; do
doSomething
done
to
while true
do
doSomething
done
Please check if this works before merging into master branch, as I currently can't use a computer. (I wrote this using Termux on android, it does not have tput)
why would you change the while loop syntax?
@neektwothousand I think it's better like this. However, if @TDGalea wants to keep the old syntax, it's fine, as both work nonetheless.
Hi both. I did start rewriting the script from scratch taking most of these changes into account, but now I've just realised I had that on my laptop's RAM disk, which I usually never shut down to preserve, but last night did so. Oops.
The only thing I won't be changing is having "do" on a separate line, as in my personal opinion that's just using up more line space for no reason. Obviously this is down to what we're all used to.
Once it's done again I'll test and publish if all goes well. Thanks for the work, @GoDzM4TT3O
I'm about to go on a four hour drive so I'll likely end up writing it on my phone also, although I'll do it over SSH to the server it's running on.
Ok, I'll change again the loop syntax so that you can merge my branch into the master branch.