| www.delorie.com/archives/browse.cgi | search | 
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm | 
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> | 
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> | 
| List-Post: | <mailto:cygwin AT cygwin DOT com> | 
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> | 
| Sender: | cygwin-owner AT cygwin DOT com | 
| Delivered-To: | mailing list cygwin AT cygwin DOT com | 
| Message-ID: | <5100B8473B3ED511B22B009027DE29093CF0F4@AKASH> | 
| From: | Surendar Singh Bisht <suren AT duncaninfotech DOT com> | 
| To: | cygwin AT cygwin DOT com | 
| Subject: | A small problem in Shell Scripts while using the built-in "read" | 
| function -- Options not recognised | |
| Date: | Thu, 17 Jan 2002 17:34:24 +0530 | 
| MIME-Version: | 1.0 | 
| X-Mailer: | Internet Mail Service (5.5.2653.19) | 
 Hi everybody!
         I'm using bash 2.05.0(8)-release on win98. I'm confronting a small
problem in shell scripts execution while using the built-in "read" function.
But the same script executes smoothly when I run this code on the command
line.
I'm using a script
	echo "Give me a character: "
	read -n1 char
	
	echo "character read is $char"
The problem is that the bash is treating the options (-n -p -d etc) as
invalid Options for "read". 
And the subsequent lines are executed in sequence.
If I use          ----->  read -n1 char
I get the errro ---->  read: Illegal option -n
If I use          ----->  read -p "Give me something:" -n1 char
I get the errro ---->  read: Illegal option -p
If I use          ----->  read -d. char
I get the errro ---->  read: Illegal option -d
If I use          ----->  read -d. -p "Give me something: " char
I get the errro ---->  read: Illegal option -d
If I use          ----->  read -p "Give me something: " -d. char
I get the errro ---->  read: Illegal option -p
Also other options ( -d, -p etc) are not being recognised.
But the same script executes smoothly when I run this code on the command
line.
Any Insight regarding the topic is welcome.
Warm Regards
Suren
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |