LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-25-2005, 02:19 PM   #1
Stepaj47
LQ Newbie
 
Registered: Oct 2005
Location: Buffalo, NY
Posts: 8

Rep: Reputation: 0
Need help on something simple...


Hi,

I am writing a bash shell script for a school project. My shell script asks a test question and tells the user if they are right or not, I got that part down. I have to ouput the user's answer to a Vi text file to act as a transaction log. I got this to work by echo'ing the answer to the file, but it overwrites the answer everytime I run the script. How do I make the script send the answer and have a log of all the answers without it overwriting everytime.

I hope I explained this ok.

Thanks in advance,
Adam
 
Old 10-25-2005, 02:33 PM   #2
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Rep: Reputation: 30
For a fantastic guide to bash, google the Advanced Bash Scripting Guide. You might find the section on I/O redirection particularly helpful...
 
Old 10-25-2005, 02:41 PM   #3
Stepaj47
LQ Newbie
 
Registered: Oct 2005
Location: Buffalo, NY
Posts: 8

Original Poster
Rep: Reputation: 0
I dont know if I have to change my coding of the shell script, or the file settings for the log file where the answer is being echoed.


thanks
 
Old 10-25-2005, 02:47 PM   #4
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Rep: Reputation: 30
you have to change the script. check out that guide.

Oh, and that's a really crappy subject line. You will get more answers if you give a more descriptive subject like "need help: logging to a file with bash"

Oh, and how could I forget: Welcome to LQ!

Last edited by Ynot Irucrem; 10-25-2005 at 02:56 PM.
 
Old 10-25-2005, 03:06 PM   #5
Stepaj47
LQ Newbie
 
Registered: Oct 2005
Location: Buffalo, NY
Posts: 8

Original Poster
Rep: Reputation: 0
Yeah I know its a crappy subject line. I found the answer, I just have to use >> instead of > and it will append to what is already in the text file.


thanks
adam
 
Old 10-25-2005, 03:12 PM   #6
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Rep: Reputation: 30
yep, congrats.
 
  


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
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 03:03 PM
Simple Questions...Hopfully Simple Answers. caps_phisto Linux - General 3 12-21-2004 01:40 PM
problems creating a simple bootable cd to perform a simple task czarherr Linux - Software 1 11-11-2004 06:22 AM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 10:03 PM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 05:08 AM


All times are GMT -5. The time now is 06:55 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration