Last active
January 24, 2016 14:37
-
-
Save christophrumpel/1c9b1266eb2a4fc74b03 to your computer and use it in GitHub Desktop.
Shell script read problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Need to check input from the user in a script. | |
| It seems there is no read version that works for zsh and normal bash. | |
| (Error when using bash: read:27: -p: no coprocess with zsh) | |
| This is why I tried to check if .zshrc file is given and depending on that I choose the read command. | |
| But even if I try it like this, I get the error "read:27: -p: no coprocess" even if it shoudln't get called | |
| because the file is given. | |
| [ -f $file ] && read -q "reply?Answer: " || read -r -p "Answer: " reply |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, thx for reply. $file was just a placeholder, but thx form mentioning it.
What I am trying to do is just a simple input in a script to make sure the user really wants to trigger it.
Just a simple YES or NO question. Is there a better way without the
readcommand?