Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 2nd, 2009, 4:51 PM   #1
gyferlotus
Newbie
 
Join Date: Sep 2009
Posts: 2
Rep Power: 0 gyferlotus is on a distinguished road
Hello, (name) Problem

#!/bin/bash
echo Hello, please say your name!
read test
echo Hello $test
exit 0



Well im currently trying to run this Script but when I run it on my shell this is the output.

Hello, please say your name! (Output)
Tom <-- (My input)
': not a valid identifier 'test (Output)
Hello (Output)

Could anyone tell me what is the problem?
Thanks
gyferlotus is offline   Reply With Quote
Old Sep 2nd, 2009, 6:30 PM   #2
L7Sqr
Professional Programmer
 
Join Date: Jun 2005
Location: here
Posts: 299
Rep Power: 6 L7Sqr will become famous soon enough
Re: Hello, (name) Problem

test is a bash reserved word (a command, actually. man test for details). Use a different variable name.
__________________
"...and though our kids are blessed their parents let them shoulder all the blame."
- The Quiet Things That No One Ever Knows [BrandNew]
L7Sqr is offline   Reply With Quote
Old Sep 2nd, 2009, 8:18 PM   #3
parul1234
Hobbyist Programmer
 
Join Date: Jul 2009
Posts: 129
Rep Power: 0 parul1234 is an unknown quantity at this point
Re: Hello, (name) Problem

Please change the variable test as it is kind of reserved word in perl
parul1234 is offline   Reply With Quote
Old Sep 3rd, 2009, 5:48 AM   #4
L7Sqr
Professional Programmer
 
Join Date: Jun 2005
Location: here
Posts: 299
Rep Power: 6 L7Sqr will become famous soon enough
Re: Hello, (name) Problem

Quote:
Originally Posted by parul1234
Please change the variable test as it is kind of reserved word in perl
What do you mean by 'kind of'? Either it is or it is not. Also, why are you describing how the above post relates to perl?
__________________
"...and though our kids are blessed their parents let them shoulder all the blame."
- The Quiet Things That No One Ever Knows [BrandNew]
L7Sqr is offline   Reply With Quote
Old Mar 9th, 2010, 1:15 PM   #5
mirneli
Newbie
 
Join Date: Mar 2010
Posts: 1
Rep Power: 0 mirneli is on a distinguished road
Re: Hello, (name) Problem

Test is a reserved work, its like echo, read. The shell will not let you use these words as a variable
mirneli is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
vb looping statement problem toki Visual Basic 2 Dec 9th, 2009 4:23 PM
Problem using isdigit help!! DJ007 C 4 May 5th, 2009 6:29 PM
How to develop problem analysis skills to enable one to decipher a given problem before coding in C++ Man G C++ 7 Apr 16th, 2009 4:49 AM
Challenging Programming Problem - "Pinball Ranking" Sane Coder's Corner Lounge 38 Jan 15th, 2008 5:16 PM
Problem solving ReggaetonKing Software Design and Algorithms 7 Jan 4th, 2008 1:49 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:02 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC