Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-02-2008, 10:19 AM   #1
Registered: Oct 2005
Location: Bangladesh
Posts: 470

Rep: Reputation: 30
Create log file against a script

Dear friends ,

Is it possible to create a "logfile" against a script in Linux platform ?

Suppose I have a script like following :

Date1=`date +%d%b%Y`
Date2=`date +%d%b%Y`.`date +%I`.`date +%M%p`
cd /test
tar -cvf test1_$Date2.tar test1
tar -cvf test2_$Date2.tar test2
ftp -i -v -n <<END_FTP
user oracle oracle
cd /tmp
mput test1_$Date2.tar
mput test2_$Date2.tar

Now if I want to create a logfile against this script , then is it possible ? plz inform me .....
Old 01-02-2008, 11:54 AM   #2
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
What do you mean "against this script"? Do you mean that you want to keep a record of the script output in a file?

If so, you can do it in several ways:
  1. Re-direct the output like this:
    script_filename > my.log
    The (possible) disadvantage of this is that you won't see the normal output in the terminal, which you might want to see.
  2. Use tee:
    script_filename | tee my.log
    This way you will see the output in the terminal and get the log file.
  3. use the script command:
    script my.log
    (press control-D to end transcript)


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
How to create log file from script fotoguy Programming 12 03-27-2012 06:39 AM
Create a script to display file name, Inode, and size of any file. Has to be a script JaxsunApex Linux - Newbie 7 01-29-2007 08:15 PM
Create a shell Script that log in as root mashed Linux - Newbie 1 04-08-2006 04:13 AM
need to create log file sanjay2004 Linux - Newbie 6 02-27-2006 11:11 AM
Script to create a log file satimis Programming 15 01-16-2006 06:39 AM

All times are GMT -5. The time now is 02:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration