Sponsored Content
Top Forums Shell Programming and Scripting Redirecting output of Make to file Post 302456663 by agama on Friday 24th of September 2010 09:50:13 PM
Old 09-24-2010
Not sure what shell you are using (&> as redirection isn't anything I recognse) and that might be some/all of the problem. The other issue might be that if no log name is given on the command line redirection is to an empty string which should generate an error.

Something like this might solve the issue:
Code:
#!/usr/bin/env ksh
# program name redirect_make.sh
# Setup
FILE="/dev/fd/1"             # default to output to tty
OUTPUTFILE="output.log"
if [ "$1" == 'log' ]
then
     FILE = $OUTPUTFILE
fi

# Now make and redirect all output to file (including errors/warnings)
# if output file has been specified, else do not redirect (print to screen)
make -f program.mak >$FILE 2>&1

/dev/fd/1 is supported by ksh; not sure whether or not bash does.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirecting my output to a specific file

Hi guys am doing some checking inside my script and i want to redirect my output to a specific file for example checking if a move was successfully done and was writing on the screen whether the move was successful or not and now want to write same thing into a file... I am new to shell... (2 Replies)
Discussion started by: Lutchumaya
2 Replies

2. Shell Programming and Scripting

Redirecting <talk> output to a file

Is it possible to run <talk> such that both sides of the conversation are written to the screen and also to a file? I use the utility to chat with collaborators and sometimes it would be nice to have a record of our conversation while we are problem solving. I am running OS X, so <talk>... (4 Replies)
Discussion started by: cej
4 Replies

3. AIX

Redirecting Both to a file and std output

Hello Friends, Can some one help me how to redirect output of a file to both a file and std output? All the help would be greatly appreciated. Regards Sridhar (1 Reply)
Discussion started by: send2sridhar
1 Replies

4. Shell Programming and Scripting

Redirecting output of a command to a file

Hi We are having a requirement where one shell script, say a.sh (which uses Java and connects to Oracle database using JDBC) keeps on running everytime. I created a wrapper (to check whether a.sh is running and if not then to start it) and scheduled it in the crontab. Now all the output from... (3 Replies)
Discussion started by: ankitgoel
3 Replies

5. Shell Programming and Scripting

Redirecting output to both console and to a file

Hi All, Is there a way in Bash we can redirection some output to both console and the file at the same time. ~Parag (2 Replies)
Discussion started by: paragkalra
2 Replies

6. Shell Programming and Scripting

Redirecting output to file

Hi, Below is the whole string which is to be redirected to the new file. su - oracle -c "exp $user/$pass file=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.dmp log=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.log tables=table1,table2 statistics=none" ... (3 Replies)
Discussion started by: milink
3 Replies

7. Shell Programming and Scripting

Redirecting output to file through cron

Hi Does anyone have any suggestions for capturing the output into a file when i run it through cron? I have file called "quick.1" which contains two simple commands to be executed on the target host. And i have second file called "quick.2" which contains the wrapper script to ssh to the target... (1 Reply)
Discussion started by: chandika_diran
1 Replies

8. UNIX for Dummies Questions & Answers

Help with redirecting output to an HTML file

I'm very new to shell scripting and am practicing how to write a script, then redirect the output into an HTML file, and then email both the script and the HTML file to myself. I have created a script called sysinfo_page, and thought it would have redirected the output into the sysinfo_page.html... (3 Replies)
Discussion started by: braing
3 Replies

9. Homework & Coursework Questions

Help with redirecting output to an HTML file

1. The problem statement, all variables and given/known data: I'm having trouble redirecting the output of my sysinfo_page script into my sysinfo_page.html file. The task at hand is to be able to email both the html file and the script to myself. I'm assuming that the html should appear as a web... (8 Replies)
Discussion started by: braing
8 Replies

10. Shell Programming and Scripting

Redirecting output to file

Hi, I have created script which redirect the output to file.I am able to get the output in file but not in the format. Output :Content of the log which have 10 -15 lines. Actal :Line1 ..Line 2Line3 Line4 Line 5 Expected:Line1 Line 2 Line3 Please... (7 Replies)
Discussion started by: karthik771
7 Replies
APS2FILE(1)						    BSD General Commands Manual 					       APS2FILE(1)

NAME
aps2file -- printing to a file via apsfilter SYNOPSIS
aps2file [-D] [-Pqueue] [-Zoptions] [-ooutput] [input] aps2file [-h] DESCRIPTION
With aps2file you can direct the printer data generated by apsfilter(1) into an arbitrary file without the use of a spooler. OPTIONS
-h show help screen -D enable debug mode -Pqueue select a printer queue (different from the default one) -Zoptions use apsfilter command line options (comma-separated list) -ooutput direct data stream to output (default: stdout) input read data from input (default: stdin) Unlike printing with lpr(1), you can only use one input file at a time. Using aps2file is also the recommended way to create a debugging log of a failed printing attempt. If you include the -D flag, the apsfilter shell script will log every command and print it to stderr. To save the output for inclusion into a bug report, you should therefore use a command of the sort aps2file -D -o /dev/null [-P...] [-Z...] [input] 2> log.txt NOTES
aps2file only works correctly with entries in /etc/printcap that have been created by /usr/share/apsfilter/SETUP. FILES
/etc/printcap printer capability data base /usr/share/apsfilter/bin/apsfilter apsfilter script SEE ALSO
apsfilter(1), apsfilter-bug(1), apspreview(1), apsfilterrc(5), printcap(5) BUGS
See apsfilter software center - http://www.apsfilter.org/ - for new versions, bugfixes and known bugs. Please use the new tool apsfilter-bug(1) to release bug- or problem reports. It automatically presents you a form in an editor window which asks you some standard questions. If you save and quit the editor session, then this report is sent automatically via e-mail to the proper apsfilter mailinglist. If apsfilter fails to print something or prints it in a way you wouldn't expect and you want to report an apsfilter error then please save the debugging output of one print session using the new aps2file(1) utility by typing aps2file -D -Z options file > /dev/null 2> file.debug and including the debugging output in the file file.debug into the edit session of the apsfilter-bug utility, so that it is included into the mail to the apsfilter mailinglist. Please note that you need to run /bin/sh (Bourne Shell), bash or a compatible shell, so that the above mentioned output redirection works. Under C-shell (/bin/csh) or tcsh it would't work. If you don't know, then simply make sure you use the Bournce shell by typing /bin/sh or bash, then you should have no problems with redirection of stdout and stderr (> /dev/null 2> file.debug). DOCUMENTATION
See official apsfilter homepage http://www.apsfilter.org/handbook.html Apsfilter Handbook including the Frequently Asked Questions (FAQ) USER FORUM
Please send questions to the official apsfilter help channel apsfilter-help@apsfilter.org. The above section BUGS and the file HOWTO-BUGREPORTS tells you how to report bugs. If you want to know how to troubleshoot your apsfilter installation, please read the manpage aps2file(1) and apsfilter-bug(1) as well as the Apsfilter Handbook carefully. HISTORY
The aps2file manpage has been written by Michael LoBin <phallobst@web.de> and first appeared in apsfilter V 7.1.0. BSD
Dec 19, 2001 BSD
All times are GMT -4. The time now is 09:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy