append command output to file by giving command in terminal
Hi,I am using openSUSE 10.3.
When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes). How can I append output of date to a file so I don't need two files? |
ummm I would do that with a small script. The tar command will be invoked from within the script. Let's the tar command arguments are passed to the script in $1 and tarball in $2
so #!/bin/ksh date > log.txt tar $1 $2 date >> log.txt do man tar, you could find something better |
The output of any command can be redirected from standard output to a file using > or >>
example $ ls > listings.txt write directory listing into a new file called listing.txt $ date >> log.txt append the current date/time to the file log.txt note that > creates a new file, >> appends to an existing one. |
You can pretty well use time command also to estimate the time.
time command It will show time it takes to completing the command. |
Code:
echo "start time: `date`" > /tmp/time.txt |
All times are GMT -5. The time now is 11:30 AM. |