Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Append the timestamp before and after the data in the logfile

by Kanji (Parson)
on Dec 22, 2005 at 05:33 UTC ( #518480=note: print w/replies, xml ) Need Help??


in reply to Re: Append the timestamp before and after the data in the logfile
in thread Append the timestamp before and after the data in the logfile

To save some typing, you can group the commands together in a subshell and redirect the subshell's output instead.

( date; perl test.pl; date ) > test.log

    --k.


  • Comment on Re^2: Append the timestamp before and after the data in the logfile
  • Download Code

Replies are listed 'Best First'.
Re^3: Append the timestamp before and after the data in the logfile
by blazar (Canon) on Dec 22, 2005 at 10:18 UTC
    No need to spawn a subshell:
    { date; perl test.pl; date; } > test.log
    will do. At least in bash, that is...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://518480]
help
Chatterbox?
[shmem]: grandola vila morena *sing*
[Discipulus]: are you sharing your memory? ;=) and ++
[shmem]: Discipulus of course ;-)
[LanX]: shmem I upvoted your reply ... for sympathy only
[LanX]: ;)
[Discipulus]: good night monks!
[shmem]: LanX: oh... now I have to figure out if this is good or bad news.
LanX bad day monks ?
[LanX]: hope you find sleep
[shmem]: LanX: which one?

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2017-04-29 22:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (534 votes). Check out past polls.