Results 1 to 3 of 3
-
07-17-2011, 01:16 PM #1Web Hosting Guru
- Join Date
- May 2011
- Posts
- 319
[Bash Script] How to set up redirect of script output within script
Hello,
I know if I would like to redirect all output of a bash script to an external file, I can run it as script.sh>output.txt
However, I am just wondering if it would be possible for me to set up the script so that if I run ./script.sh, it will automatically create a file called output.txt, put all the results there?
Thanks!█96MB.com
█Low-end VPS review blog running on 96MB of RAM
-
07-17-2011, 02:11 PM #2Web Hosting Master
- Join Date
- Apr 2003
- Location
- Los Angeles, CA
- Posts
- 820
This should work
Code:#!/bin/bash ( original commands here ) > output.txt
Pings <1 ms, Unlimited Transfer, Lowest Price: http://localhost/
-
07-17-2011, 09:10 PM #3Web Hosting Guru
- Join Date
- May 2011
- Posts
- 319
Thanks a lot!
█96MB.com
█Low-end VPS review blog running on 96MB of RAM
Similar Threads
-
Extracting a username from bash script output.
By ZKuJoe in forum Programming DiscussionReplies: 3Last Post: 02-17-2010, 06:00 AM -
Can .htaccess call a script (e.g. a bash .sh script)?
By Kadence in forum Hosting Security and TechnologyReplies: 7Last Post: 03-26-2008, 03:59 PM -
Clearance - MS script, SMS script, Train script, Game Cheat Scripts & More!!
By cnv in forum Other Offers & RequestsReplies: 14Last Post: 06-08-2006, 08:41 PM -
bash script
By Dmitry85 in forum Programming DiscussionReplies: 2Last Post: 04-10-2006, 04:39 PM -
bash comman/bash script
By getbusy in forum Hosting Security and TechnologyReplies: 2Last Post: 12-25-2004, 06:50 PM