Sponsored Content
Top Forums Shell Programming and Scripting Asking about shell script input output redirection Post 302093192 by Yogesh Sawant on Wednesday 18th of October 2006 01:13:18 AM
Old 10-18-2006
Code:
ls >& outfile

output of ls command is redirected in a file named outfile


ls outfile 2>&1
if a file named outfile exists, then it is listed, and along with it, errors (represented by 2) are redirected to standard output (represented by 1), but that isn't useful in this case, you would have got any error on your terminal anyway.

if file outfile does not exist, then you will get message:
ls: newfile: No such file or directory
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script getting input from output

I have a program that can be run in terminal, when its run it either returns SSH OK or CRITICAL, how do i use the output in my script? good ./check_sh myserver SSH OK bad ./check_sh myserver CRITICAL I want to store it in a variable btw, SSH OK will give the variable $SSH=1 and if its... (1 Reply)
Discussion started by: aspect_p
1 Replies

2. Shell Programming and Scripting

How to check for Input Redirection in my script?

All, I have a requirement to write a script where I check for Input redirection when the script was executed, based on which I handle my logic. Below is the example: my.script #! /bin/ksh # Not sure how to frame the if condition below if ; then echo "Input Redirected from a file" ... (7 Replies)
Discussion started by: bharath.gct
7 Replies

3. Programming

Redirect input and output to a shell script?

Dear All: I am trying to do something that (I thought) was relatively straightforward, but my code snippet does not seem to work. Any suggestions? Thank you Sincerely yours Misha Koshelev #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include... (0 Replies)
Discussion started by: misha680
0 Replies

4. Shell Programming and Scripting

Help with Output Redirection of a Unix Shell Script

Hi Guys, I have a script for which the stdout and stderr should be redirected to a log file, they should not be printed on the screen. Could you please let me know the procedure to redirect the output of the script to a log file. Thanks in advance. --- Aditya (5 Replies)
Discussion started by: chaditya
5 Replies

5. Shell Programming and Scripting

Read input and output redirection filename within a script

Hello everyone, My requirement is that within a script I need to construct the command line exactly that it was invoked with. For example : sh a.sh arg1 arg2 arg3 < input.txt > output.txt Now within a.sh, I construct a file which has these contents " sh a.sh arg1 arg2 arg3 < input.txt >... (8 Replies)
Discussion started by: hedonist12
8 Replies

6. Shell Programming and Scripting

Shell script output redirection question

OS : AIX 6.1 Shell : Korn in the url https://forums.oracle.com/forums/thread.jspa?threadID=361463&tstart=0 I came across a crontab entry example 00 23 * * 1,3,5 <complete shell script path> 1> <log file> 2>&1 From googling , I gathered that 0 - stdin 1 - stdout 2 - stderr I... (5 Replies)
Discussion started by: polavan
5 Replies

7. Shell Programming and Scripting

Output redirection of c binary file to a file in shell script is failing

I am struck up with a problem and that is with output redirection. I used all the ways for the redirection of the output of c binary to a file, still it is failing. Here are the different ways which I have used: ./a.out | tee -a /root/tmp.txt 2>&1 ./a.out | tee -a /root/tmp.txt 1>&1 ./a.out |... (2 Replies)
Discussion started by: Maya29988
2 Replies

8. Shell Programming and Scripting

Shell Script - File Input/Output in C

This is part of my code: for in_file in $1/*.in # list of all .in files in working directory. do $c_file < $in_file > "$tempFile.out" if diff "$tempFile.out" $out_file >/dev/null 2>&1 ; then ... (6 Replies)
Discussion started by: spider-man
6 Replies

9. Shell Programming and Scripting

Input redirection script

Hi, #!/bin/bash while ; do rm -f /tmp/pipe mkfifo /tmp/pipe ./yuv4mpeg_to_v4l2 < /tmp/pipe & mplayer tom_and_jerry.mp4 -vf scale=480:360 -vo yuv4mpeg:file=/tmp/pipe sleep 65; done When I run this - after mplayer finishes playing video it says - Exiting... (End of... (2 Replies)
Discussion started by: ashokvpp
2 Replies

10. Shell Programming and Scripting

Input redirection within bash script

Hi, when I try to redirect input and the command is described as a string within an array redirection does not work. why? #!/bin/bash dir=("tail < ./hello.txt") tail < ./hello.txt #works ${dir} #does not work (2 Replies)
Discussion started by: heinzel
2 Replies
MKUZIP(8)						    BSD System Manager's Manual 						 MKUZIP(8)

NAME
mkuzip -- compress disk image for use with geom_uzip(4) class SYNOPSIS
mkuzip [-v] [-o outfile] [-s cluster_size] infile DESCRIPTION
The mkuzip utility compresses a disk image file so that the geom_uzip(4) class will be able to decompress the resulting image at run-time. This allows for a significant reduction of size of disk image at the expense of some CPU time required to decompress the data each time it is read. The mkuzip utility works in two phases: 1. An infile image is split into clusters; each cluster is compressed using zlib(3). 2. The resulting set of compressed clusters along with headers that allow locating each individual cluster is written to the output file. The options are: -o outfile Name of the output file outfile. The default is to use the input name with the suffix .uzip. -s cluster_size Split the image into clusters of cluster_size bytes, 16384 bytes by default. The cluster_size should be a multiple of 512 bytes. -v Display verbose messages. NOTES
The compression ratio largely depends on the cluster size used. For large cluster sizes (16K and higher), typical compression ratios are only 1-2% less than those achieved with gzip(1). However, it should be kept in mind that larger cluster sizes lead to higher overhead in the geom_uzip(4) class, as the class has to decompress the whole cluster even if only a few bytes from that cluster have to be read. The mkuzip utility inserts a short shell script at the beginning of the generated image, which makes it possible to ``run'' the image just like any other shell script. The script tries to load the geom_uzip(4) class if it is not loaded, configure the image as an md(4) disk device using mdconfig(8), and automatically mount it using mount_cd9660(8) on the mount point provided as the first argument to the script. EXIT STATUS
The mkuzip utility exits 0 on success, and >0 if an error occurs. SEE ALSO
gzip(1), zlib(3), geom(4), geom_uzip(4), md(4), mdconfig(8), mount_cd9660(8) AUTHORS
Maxim Sobolev <sobomax@FreeBSD.org> BSD
March 17, 2006 BSD
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy