Sponsored Content
Top Forums Shell Programming and Scripting Redirecting output of Make to file Post 302456644 by srujan45 on Friday 24th of September 2010 07:28:37 PM
Old 09-24-2010
Redirecting output of Make to file

Hi,

I am unable to get this script to work as desired. Basically, if an argument "log" is sent into the script, it outputs the result of the Make to a file output.log. However, if the argument is not passed, I want the output to be just put on screen (no redirection). See code snippet below.
Code:
# program name redirect_make.sh
# Setup
FILE=
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"

Regards
Srujan

---------- Post updated at 06:28 PM ---------- Previous update was at 06:26 PM ----------

Oh, if it is not clear - the entire code snippet I have mentioned above is the shell script itself (meaning, the make command is part of the script itself)

Last edited by Scott; 09-25-2010 at 04:57 AM.. Reason: Please use code tags
 

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
SEIVOT(1)						      General Commands Manual							 SEIVOT(1)

NAME
seivot - benchmark backup application (obnam) SYNOPSIS
seivot [--benchmark-fsck] [--config=FILE] [--description=TEXT] [--drop-caches] [--dump-config] [--dump-memory-profile=METHOD] [--dump-setting-names] [--encrypt-with=KEYID] [--file-size=SIZE] [--generate-manpage=TEMPLATE] [--generations=COUNT] [-h] [--help] [--incremental-data=SIZE] [--initial-data=SIZE] [--larch-branch=LARCH-BRANCH] [--list-config-files] [--log=FILE] [--log-keep=N] [--log-level=LEVEL] [--log-max=SIZE] [--log-mode=MODE] [--no-default-configs] [--obnam-branch=OBNAM-BRANCH] [--obnam-config=FILE] [--obnam-profile=NAMEPATTERN] [--output=FILE] [--profile-name=PROFILE-NAME] [--program=PROGRAM] [--sftp-delay=SFTP-DELAY] [--use-existing=DIR] [--use-sftp-repository] [--use-sftp-root] [--verify] [--version] [FILE]... DESCRIPTION
seivot benchmarks a backup application. It has been written primarily for obnam(1), but could be extended for other backup applications. seivot generates some live data using genbackupdata(1), and then runs the backup application. It then generates some more live data, and runs a second backup generation, etc. It stores the measurements in an output file. See seivots-summary(1) for a tool to show data from such files in a tabular fashion. (seivot does not itself show the tabular data, because one is rarely interested in the output from just one run, and instead wants to contrast it with other runs). OPTIONS
--benchmark-fsck benchmark fsck? --config=FILE add FILE to config files --description=TEXT free-form description of this backup run --drop-caches clear Linux kernel cache before running commands (will ask for sudo pasword --dump-config write out the entire current configuration --dump-memory-profile=METHOD make memory profiling dumps using METHOD, which is one of: none, simple, meliae, or heapy (default: simple) --dump-setting-names write out all names of settings and quit --encrypt-with=KEYID encrypt backups with KEYID --file-size=SIZE size of files to create --generate-manpage=TEMPLATE fill in manual page TEMPLATE --generations=COUNT total number of generations to measure (5) -h, --help show this help message and exit --incremental-data=SIZE add SIZE live data for additional generations (1024) --initial-data=SIZE size of initial live data (1024) --larch-branch=LARCH-BRANCH bzr branch from which to use larch (default is installed larch) --list-config-files list all possible config files --log=FILE write log entries to FILE (default is to not write log files at all); use "syslog" to log to system log, or "none" to disable log- ging --log-keep=N keep last N logs (10) --log-level=LEVEL log at LEVEL, one of debug, info, warning, error, critical, fatal (default: debug) --log-max=SIZE rotate logs larger than SIZE, zero for never (default: 0) --log-mode=MODE set permissions of new log files to MODE (octal; default 0600) --no-default-configs clear list of configuration files to read --obnam-branch=OBNAM-BRANCH bzr branch from which to run obnam (default is installed obnam) --obnam-config=FILE use FILE as an Obnam configuration file --obnam-profile=NAMEPATTERN store Python profiling output in files named after NAMEPATTERN (no profiling, unless set); %(foo)s in pattern gets filled in, where foo is op (for backup/restore/etc), gen, or order (cumulative/time) --output=FILE write output to FILE, instead of standard output --profile-name=PROFILE-NAME name of backup use-case profile name (for documentation purposes only) --program=PROGRAM program to benchmark (obnam) --sftp-delay=SFTP-DELAY add an artificial delay (in milliseconds) to all SFTP transfers --use-existing=DIR use exiting DIR for initial generation --use-sftp-repository access backup repository over the network via sftp --use-sftp-root access backup repository over the network via sftp --verify verify restored data --version show program's version number and exit EXAMPLE
To run a simple benchmark: seivot --initial-data=10G --incremental-data=1G SEE ALSO
seivots-summary(1), obnam(1). SEIVOT(1)
All times are GMT -4. The time now is 06:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy