LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-17-2006, 03:11 PM   #1
beanxp
LQ Newbie
 
Registered: Nov 2006
Posts: 4

Rep: Reputation: 0
linux shell program problem


hi,all,
I have a very simple linux shell program, but it can not run properly, can anyone tell me what wrong with the program.
Code:
#!/bin/sh
echo "Is it morning,please anser(Yes/No)"
read timeofday
echo $timeofday
The error message is "': not a valid identifiertimeofday" after I input "Yes" or "No".
Thanks
 
Old 11-17-2006, 03:23 PM   #2
demon_vox
Member
 
Registered: May 2006
Location: Argentina
Distribution: SuSE 10
Posts: 173

Rep: Reputation: 30
Hi,
I tried your code and it worked fined...
Perhaps you could try commenting the first line to see if that one makes you trouble,but its not very likely.
Or perhaps there is some alias or something defined for the name timeofday. You could try changing the name for that variable to see if it works.

Just some thoughts
Cheers!
 
Old 11-17-2006, 03:36 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Works for me:
Code:
$ cat > test.sh
#!/bin/sh
echo "Is it morning,please anser(Yes/No)"
read timeofday
echo $timeofday
$ chmod 755 test.sh
$ ./test.sh
Is it morning,please anser(Yes/No)
No
No
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem running C++ program in Linux Shell Alkibiades Programming 17 10-28-2006 06:51 AM
How do I install a program from a shell, and how do I update parts of Linux? banjzooie Linux - Software 3 02-11-2006 09:48 AM
Urgent: Call a C program through Linux shell script nuwandee Programming 14 04-10-2004 07:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration