LinuxQuestions.org
Review your favorite Linux distribution.
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 06-14-2010, 11:10 AM   #1
linuxromeo
Member
 
Registered: Jun 2010
Posts: 45

Rep: Reputation: 15
Thumbs down Redirect set -x to a file


Hi

I know that set -x can be used for debugging a shell script.
But I want to redirect the output of set -x to a text file.

eg: Say test.sh is my script,

Thanks in advance for your valuable help...
 
Old 06-14-2010, 11:20 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
set -x echos to standard error, so when you run your script, simply redirect stderr into the file.

Code:
./test.sh 2>file.txt
 
1 members found this post helpful.
Old 06-14-2010, 11:31 AM   #3
linuxromeo
Member
 
Registered: Jun 2010
Posts: 45

Original Poster
Rep: Reputation: 15
Thanks!!!
 
Old 06-14-2010, 09:23 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,565

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
Please mark as SOLVED once you have a solution.
 
  


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
redirect stdout to file produces blank file kissaki Linux - Software 5 01-06-2009 04:28 AM
how to set redirect command can be wrote such as:$ ls > filelist.txt,are there hillpigLQ Linux From Scratch 2 09-19-2008 10:55 PM
how to set redirect for all commands hillpigLQ Linux From Scratch 1 09-19-2008 01:27 PM
how to set redirect for all commands hillpigLQ Linux - Newbie 1 09-19-2008 06:51 AM
trying to redirect text to a file to cat at later point. says file doesn't exist. dr_zayus69 Programming 1 10-02-2005 09:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:54 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