From owner-freebsd-questions Tue Jun 4 7:47:19 2002 Delivered-To: freebsd-questions@freebsd.org Received: from PHSEXCHICI2.Partners.org (phsexchici2.partners.org [170.223.254.21]) by hub.freebsd.org (Postfix) with ESMTP id 5FE8037B43C for ; Tue, 4 Jun 2002 07:46:06 -0700 (PDT) Received: by phsexchici2.partners.org with Internet Mail Service (5.5.2650.21) id ; Tue, 4 Jun 2002 10:46:05 -0400 Message-ID: <375F68784081D511908A00508BE3BB1701EF1B2D@phsexch22.mgh.harvard.edu> From: "Morse, Richard E." To: "'steve@northnetworks.ca'" , freebsd-questions@freebsd.org Subject: RE: Logging commands... Date: Tue, 4 Jun 2002 10:46:03 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="ISO-8859-1" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Steve Bertrand [mailto:steve@northnetworks.ca] wrote: > I am running FreeBSD 4.5 and am about to config and install > amanda backup > software (www.amanda.org). Cool! I've got this up and running in my small installation (backing up about 6 machines, mostly Solaris)... > How can I output the actual commands to a text file without > sending the > result of a command to the file? Is it possible? The two most commonly used shells ([t]csh and bash) have a 'history' mechanism, which stores the 'n' most recently used commands to a file. In tcsh, the file is ~/.history. It may be different under bash. You should, in theory, be able to set your history to be a large enough value, then later on go and copy out what you need from this file. It's not perfect, but it's straightforward. An alternative might be to use the following perl script [UNTESTED]: ----------- #!/usr/bin/perl -w use strict; use warnings; my $out_file_name = shift @ARGV; open(my $out, ">>", $out_file_name) or die("Can't open $out_file_name: $!"); print $out "Script from ", scalar(localtime), "\n\n"; my $done = 0; while(!$done) { chomp(my $curr_dir = `pwd`); print $curr_dir, " %"; chomp(my $in = <>); print $out $in, "\n"; if ($in eq 'exit') { $done++; } else { `$in`; } } close($out); __END__ --------------- I have no clue if this will properly output data to the console -- you may have to spend more than about 3 minutes writing it to get it to show you what's happening... HTH, Ricky To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message