Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 734311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:21:30+00:00 2026-05-14T07:21:30+00:00

Okay so I am having this problem. I write up a script to be

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:21:30+00:00Added an answer on May 14, 2026 at 7:21 am

    You should do an od -xcb on that script. My guesstimate is that it’s almost certainly going to have the wrong line ending character in it.

    The reason I suggest this is because the line:

    ': not a valid identifierad: `var_name
    

    looks suspiciously like the two lines:

    .........................ad: `var_name
    ': not a valid identifier
    

    merged together (where the . characters indicate something that’s been overwritten).

    That would be the case if your variable in that line was var_namecarriage-return rather than the more normal var_name.

    The fact that it’s Cygwin also points to that conclusion since there’s often trouble when you edit your scripts with a Windows editor which uses CR/LF where Cygwin expects just LF.

    I suspect you’ll find that doing an od -xcb on your actual script shows that you have those Windows line endings on one or more of your script lines.


    In fact, I just tested this under Ubuntu by putting a CTRL-M at the end of just the read line and the output was (slightly modified to show the CTRL-M):

    pax@pax-desktop:~$ od -xcb qq.sh ; ./qq.sh
    
    0000000    2123    622f    6e69    622f    7361    0a68    6365    6f68
              #   !   /   b   i   n   /   b   a   s   h  \n   e   c   h   o
            043 041 057 142 151 156 057 142 141 163 150 012 145 143 150 157
    0000020    2d20    2065    4522    746e    7265    7920    756f    2072
                  -   e       "   E   n   t   e   r       y   o   u   r    
            040 055 145 040 042 105 156 164 145 162 040 171 157 165 162 040
    0000040    616e    656d    6120    646e    7020    6572    7373    5b20
              n   a   m   e       a   n   d       p   r   e   s   s       [
            156 141 155 145 040 141 156 144 040 160 162 145 163 163 040 133
    0000060    4e45    4554    5d52    203a    635c    2022    720a    6165
              E   N   T   E   R   ]   :       \   c   "      \n   r   e   a
            105 116 124 105 122 135 072 040 134 143 042 040 012 162 145 141
    0000100    2064    6176    5f72    616e    656d    0a0d    6365    6f68
              d       v   a   r   _   n   a   m   e  \r  \n   e   c   h   o
                                                     ^^
    
            144 040 166 141 162 137 156 141 155 145 015 012 145 143 150 157
    0000120    2220    6f59    7275    6e20    6d61    2065    7369    203a
                  "   Y   o   u   r       n   a   m   e       i   s   :    
            040 042 131 157 165 162 040 156 141 155 145 040 151 163 072 040
    0000140    7624    7261    6e5f    6d61    2265    0a0a
              $   v   a   r   _   n   a   m   e   "  \n  \n
            044 166 141 162 137 156 141 155 145 042 012 012
    0000154
    
    Enter your name and press [ENTER]: Pax
    ': not a valid identifierar_name
    Your name is: 
    

    In other words, very similar to what you’re seeing.


    As an aside (now that I have access to my Cygwin environment), what you’re seeing is the output:

    abcdefghij.sh: line 99 read: `var_name
    `: not a valid identifier
    

    where the second line overwrites the first, giving:

    `: not a valid identifierad: `var_name
    

    In other words, the strange word identifierad is actually made up of identifier and the final ad: from read:. The reason it’s only similar to my example above (as opposed to exact) is because your file name and line number will be different to my little test script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 392k
  • Answers 392k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Java, untested. List<String> clauses = new ArrayList<String>(); List<String> binds =… May 15, 2026 at 1:42 am
  • Editorial Team
    Editorial Team added an answer TweetSharp will handle all of the encoding for you. Just… May 15, 2026 at 1:42 am
  • Editorial Team
    Editorial Team added an answer If you mean something like this: while (true) { Socket… May 15, 2026 at 1:42 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.