Bash Shell; read command; using Cygwin on Windows 7

Posted by user312397 on Stack Overflow See other posts from Stack Overflow or by user312397
Published on 2010-04-09T00:10:57Z Indexed on 2010/04/09 0:13 UTC
Read the original article Hit count: 470

Filed under:
|
|

Okay so I am having this problem. I write up a script to be run in cygwin on Windows. I've tried a bunch of basic example scripts in case it was my scripts problem.

So I tried this:

#!/bin/bash
echo -e "Enter your name and press [ENTER]: \c" 
read var_name
echo "Your name is: $var_name"

Then I will run it and I enter a name for var_name.

I get this:

$ ./project1.sh
Enter your name and press [ENTER]: Jake
': not a valid identifierad: `var_name
Your name is:

So as far as I understand it I am having a problem with read. I am trying to work on a project for my class, but I can't seem to figure out why it won't read it. I followed the book with no triumph then resorted to these examples on the web that do not seem to work for me either. Does anyone have any idea if it is my setup or if I am missing something, thanks.

© Stack Overflow or respective owner

Related posts about unix-programming

Related posts about cygwin