This is the mail archive of the
mailing list for the Cygwin project.
Re: GCC compiler cannot create executables.
- From: Michael A Chase <mchase at ix dot netcom dot com>
- To: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>, cygwin at cygwin dot com
- Cc: Ryan Budge <ryan at smarthand dot co dot za>
- Date: Fri, 6 Dec 2002 09:47:41 -0800 (PST)
- Subject: Re: GCC compiler cannot create executables.
- Fcc: SentMail
- References: <Pine.GSO.firstname.lastname@example.org>
- Reply-to: Michael A Chase <mchase at ix dot netcom dot com>
On Fri, 6 Dec 2002 12:05:24 -0500 (EST) Igor Pechtchanski <email@example.com> wrote:
> FWIW, there's also apparently a cygwin port of 'script':
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.
# Find nearest log directory and tee log command output to a file there
# set -xv
if [ 1 -le $# ]; then $rc="$1"; shift; else rc=0; fi
"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]...
-l log = Log file ($log)
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
if [ 0 = "$rc" ]; then echo "$msg"; else echo "$msg" >&2; fi
while getopts ':hl:' OPT
case $OPT in
l) log="$OPTARG" ;;
h) usage 0 ;;
*) usage 1 "Invalid Option: -$OPTARG" ;;
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"
# Find log directory and build log file name
if [ -z "$log" ]; then
while :; do
if [ "/" = "$logbase" ]; then
echo "Log directory not found under $PWD"
if [ -d "$logbase/log" -a -w "$logbase/log" ]; then break; fi
echo "Log file: $log"
echo "Dir: '$PWD'" >> "$log"
echo "Command:" "$@" >> "$log"
"$@" 2>&1 | tee -a "$log"
echo "Log file: $log"
** 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.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html