I am having some issues where running a script that I have placed in my file browsers scripts folder making it runnable from the right-click menu, is not capable of actually producing a prompt for user-input when the read command is called.
Is there any way to force it to create the prompt?
This is the code I am using to test it, nothing much:
#!/bin/bash
read -p "Hour " answer
hours=$answer
My script is being invoked from the right-click menu in Nemo (the file browser in Linux Mint 19.2), being installed in /home/username/.local/share/nemo/scripts
.
read
works fine from a terminal, or running a script with "run in terminal", but the right-click menu in Nemo doesn't start one.
#!/bin/bash
shebang is honored? (sh yourscript
, for example, will ignore that shebang and run your script withsh
, notbash
;sh
is not guaranteed to supportread -p
). – Charles Duffy Oct 7 at 14:57hours=$answer
doesn't do anything useful. You can just writeread -p "Hour " hours
instead. – chepner Oct 7 at 14:58sh
instead of bash, there's not enough information here for us to know which "file browser" this is, or how it's configured. Please ensure that your question is a minimal reproducible example, with everything needed for someone else to see the problem themselves included. – Charles Duffy Oct 7 at 14:59echo "stdout"; echo "stderr" >&2
, and see if both are printed;echo "Bash version: $BASH_VERSION"
, and see if the version string prints. – Charles Duffy Oct 7 at 15:00if [ -t 2 ]; then echo "stderr is directed to the TTY"; else echo "stderr is NOT directed to the TTY"; fi
– Charles Duffy Oct 7 at 15:07