LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 02-26-2010, 09:09 AM   #1
sivga1
LQ Newbie
 
Registered: Feb 2010
Posts: 1

Rep: Reputation: 0
expect script


Hi I have defined log file in script

log_file -a $ logfile

I'm running some unix commands in script and I dont want the unix comamnd or its output (e.g ls ,mkdir etc )getting dummped to $logfile ...Tried log_user 0/1 but it did not help.

Is there a way to tell what needs to be logged to $logfile.

thanks
 
Old 02-26-2010, 01:31 PM   #2
SethsdadtheLinuxer
Member
 
Registered: Jun 2007
Posts: 152

Rep: Reputation: 37
use 1>x and 2>y to redirect stdout and stderr in your script.

if you do this
cmda 1>/dev/null
cmdb 1>logfile.txt
cmdc 1>/dev/null

logfile.txt will only get output from cmdb.
 
Old 02-26-2010, 01:36 PM   #3
jvaldivia
Member
 
Registered: Sep 2007
Distribution: Debian Lenny
Posts: 61
Blog Entries: 2

Rep: Reputation: 19
I found a really awesome bash script started to log everything that happened to your script, you can review it here:

http://soad1982.blogspot.com/2010/02...t-to-file.html
 
  


Reply



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
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 09:06 PM
is it possible in expect script packets Programming 2 12-14-2009 08:01 PM
Expect script help shriyer Linux - Server 3 07-08-2009 08:42 PM
Expect Script coolest Programming 7 02-16-2009 03:59 PM
expect script output saltydog4791 Programming 1 05-27-2008 08:01 AM

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

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