PDA

View Full Version : [ubuntu] Start program and send output to file



redgar
August 3rd, 2009, 04:39 AM
I'm new to bash scripting...started 10 minutes ago. I need to write a simple program to execute a program (the name of the program is 'reset') and then send the output of the program to a file (the name of the output file is 'result'). This is what I've drafted after using the web. I haven't coded the program file yet. Please help.

#!/bin/bash
echo $PATH
echo Start of Program

#Start program & send output to file
sudo reset & > result.txt
exit 0

credobyte
August 3rd, 2009, 04:44 AM
sudo ./reset > result.txt
Also, do you really need to use sudo ?

llamabr
August 3rd, 2009, 05:40 AM
And frankly, not to be obtuse, and I know they hate when I mention man pages around here, but the bash man page has lots of interesting info about this, and the differences and uses of >, >>, |, etc.