Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Fri, 6 Dec 2002 09:47:41 -0800 (PST) From: Michael A Chase Subject: Re: GCC compiler cannot create executables. To: Igor Pechtchanski , cygwin AT cygwin DOT com cc: Ryan Budge Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="279716865-1681692777-1039196863=:1879" references: in-reply-to: fcc: SentMail Reply-To: Michael A Chase --279716865-1681692777-1039196863=:1879 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Disposition: INLINE On Fri, 6 Dec 2002 12:05:24 -0500 (EST) Igor Pechtchanski wrote: > FWIW, there's also apparently a cygwin port of 'script': > http://cygwin.com/ml/cygwin/2002-09/msg01371.html It's also easy to redirect STDOUT and STDERR to a file. I found myself doing it often enough that I wrote a script to do it for me. It needs a log/ directory in the current directory or one of its parents. --279716865-1681692777-1039196863=:1879 Content-Type: TEXT/PLAIN; NAME="/home/mchase/bin/tlog.sh"; CHARSET=US-ASCII Content-Disposition: INLINE; FILENAME="tlog.sh" #!/bin/bash # Find nearest log directory and tee log command output to a file there # set -xv log="" usage() { if [ 1 -le $# ]; then $rc="$1"; shift; else rc=0; fi basename=$(basename "$0") msg=\ "Send stdout and stderr to a log file If no log file is specified, search for the nearest log/ directory in ./, ../, ../../ until / is reached and generate a file name based on the command name and the current date and time. syntax: $basename [opt] cmd [arg]... Opt: -l log = Log file ($log) Arg: cmd = Command to execute arg = Options and arguments to cmd" while [ 1 -le $# ]; do if [ 0 = "$rc" ]; then echo "$1"; else echo "$1" >&2; fi shift done if [ 0 = "$rc" ]; then echo "$msg"; else echo "$msg" >&2; fi exit $rc } while getopts ':hl:' OPT do case $OPT in l) log="$OPTARG" ;; h) usage 0 ;; *) usage 1 "Invalid Option: -$OPTARG" ;; esac done if [ 1 -lt $OPTIND ]; then shift $(expr $OPTIND - 1); fi # Make sure there is a command name if [ 1 -gt $# ]; then echo "No command name" exit 1 fi cmd=$(basename "$1") # Find log directory and build log file name if [ -z "$log" ]; then logbase="$PWD" while :; do if [ "/" = "$logbase" ]; then echo "Log directory not found under $PWD" exit 1 fi if [ -d "$logbase/log" -a -w "$logbase/log" ]; then break; fi logbase=`dirname "$logbase"` done dt=$(date +%y%m%d_%H%M) log="$logbase/log/$cmd-$dt.log" fi echo "Log file: $log" touch "$log" echo "Dir: '$PWD'" >> "$log" echo "Command:" "$@" >> "$log" "$@" 2>&1 | tee -a "$log" echo "Log file: $log" --279716865-1681692777-1039196863=:1879 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Disposition: INLINE -- Mac :}) ** I normally forward private questions to the appropriate mail list. ** Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age. --279716865-1681692777-1039196863=:1879 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --279716865-1681692777-1039196863=:1879--