JP Vossen on 4 Sep 2011 14:36:10 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] Capturing command line, and stdio and error with bash |
Date: Sun, 4 Sep 2011 08:35:57 -0400 From: Edmond Rodriguez<erodrig97.list@gmail.com> Well there has been lots of mail about redirection in bash. I have a question about logging. The script command logs ALL output to the terminal (editing keys, backspaces, up arrows, ...). I just want what I see after I hit the enter key.
[...]I usually cheat like heck on this one and use 'screen'. I require use of 'screen' for some stuff at $WORK so that if the user is kicked off the VPN or whatever, they can recover. But as an added bonus, you can get this kind of logging. Except--come to think of it, I'm not 100% you still don't get the control characters (and I can't check at the moment)... So YMMV.
SCREEN='/usr/bin/screen' [...| $SCREEN -X logfile $LogDirPrefix/file.log \ && $SCREEN -X log on # code goes here $SCREEN -X logfile 1 # Set logfile buffer to 1 sec. (default's 10) $SLEEP 3 # Wait 3 seconds, to avoid truncation $SCREEN -X log off # Turn off the logThe other way to cheat is to use the terminal's scroll-back buffer and/or logging feature. That works great for docs but not so well for logging scripts from cron or whatever. Though the OP question did sound kind of interactive...
HTH, JP ----------------------------|:::======|------------------------------- JP Vossen, CISSP |:::======| http://bashcookbook.com/ My Account, My Opinions |=========| http://www.jpsdomain.org/ ----------------------------|=========|------------------------------- "Microsoft Tax" = the additional hardware & yearly fees for the add-on software required to protect Windows from its own poorly designed and implemented self, while the overhead incidentally flattens Moore's Law. ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug