Mar 8, 2006 #1 riffraff667 ISP Joined Aug 30, 2001 Messages 58 Location US how do you do a standard input prompt with a shell script?
Mar 8, 2006 #2 motoslide MIS Joined Oct 30, 2002 Messages 764 Location US It probably depends on your shell, but this works in /bin/sh: echo -n "Enter something: " read ans echo "You just typed $ans" I don't think the "-n" is standard. Upvote 0 Downvote
It probably depends on your shell, but this works in /bin/sh: echo -n "Enter something: " read ans echo "You just typed $ans" I don't think the "-n" is standard.
Mar 8, 2006 Thread starter #3 riffraff667 ISP Joined Aug 30, 2001 Messages 58 Location US thanks Upvote 0 Downvote
Mar 8, 2006 #4 elgrandeperro Technical User Joined Dec 8, 2005 Messages 1,049 Location US Yeah, do "man echo". The command /usr/bin/echo DOES do -n, as well as the builtin echo of csh, but ksh does not, Bourne does... gene Upvote 0 Downvote
Yeah, do "man echo". The command /usr/bin/echo DOES do -n, as well as the builtin echo of csh, but ksh does not, Bourne does... gene
Mar 8, 2006 #5 elgrandeperro Technical User Joined Dec 8, 2005 Messages 1,049 Location US yeah, if echo -n doesn't work, use a \c to suppress the carriage return. gene Upvote 0 Downvote
Mar 9, 2006 #6 p5wizard IS-IT--Management Joined Apr 18, 2005 Messages 3,165 Location BE or use printf "Enter something: " read answer if you have printf HTH, p5wizard Upvote 0 Downvote
Mar 9, 2006 #7 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi And if you have [tt]bash[/tt] : Code: read -p "Enter something: " ans echo "You just typed $ans" Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi And if you have [tt]bash[/tt] : Code: read -p "Enter something: " ans echo "You just typed $ans" Feherke. http://rootshell.be/~feherke/
Mar 9, 2006 1 #8 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR And in ksh: read ans?"Enter something: " echo "You just typed $ans" Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
And in ksh: read ans?"Enter something: " echo "You just typed $ans" Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886