04-14-2011
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi friends
I am facing one problem while redirecting the out of the stderr and stdout to a file
let example my problem with a simple example
I have a file (say test.sh)in which i run 2 command in the background
ps -ef &
ls &
and now i am run this file and redirect the output to a file... (8 Replies)
Discussion started by: sushantnirwan
8 Replies
2. Shell Programming and Scripting
Is there a way to redirect all stdout to a file implicitly - like defining stdout=/home/me/process.log - so that all "echo" commands in several scripts/subscripts are written to that file; instead of having to edit all scripts to redirect the "echo" (e.g. echo 'This is a test ' >>... (1 Reply)
Discussion started by: ALTRUNVRSOFLN
1 Replies
3. Programming
Hello! I want to post a question. does anybody know how to print the output of a C program both in stdout and a file??
thanx (8 Replies)
Discussion started by: nicos
8 Replies
4. Shell Programming and Scripting
working on a c sell script
I think I understand the concept of it, which is:
filename >> file.txt (to appaend)
or filename | tee -a file.txt (to append)
The problem is that my shell script is used with several parameters, and these commands don't seem to work with just filename. They... (2 Replies)
Discussion started by: mistermojo
2 Replies
5. Shell Programming and Scripting
Is there a way to alter the file descriptor for stdout.?
sample:
#!/bin/ksh
exec 1>file
exec 2>file
echo hi --------->This will go to file
print -u4 "come statement"---->I want to make the file descriptor 4 to point to stdout.
The reason is ,I have a script which has lot of db2... (1 Reply)
Discussion started by: prasperl
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
Does anyone know if there is an unzip command similar to
tar -xOf $tarBall $fileInTarFile
which will untar a single file in a tar ball to STDOUT ?
I want to do the same but with a .zip (ZIP archive) file.
- Andy
---------- Post updated at 05:56 PM ---------- Previous update... (0 Replies)
Discussion started by: andyatit
0 Replies
7. Programming
I originally wrote my script using the korn shell and had to port it to bash on a another server. My script is working find for backing up but noticed that now after the move, I am not getting any output to my log files.
Using Korn shell, this worked for me for some odd reason. This was sending... (2 Replies)
Discussion started by: metallica1973
2 Replies
8. Shell Programming and Scripting
I have a C program that continously outputs info to stdout. The problem is that I am redirecting the stdout and stderr to a file and stdout is written at the end of the problem rather than continously to the file. This could be a problem if for example the program is killed and the stdout output is... (3 Replies)
Discussion started by: igurov
3 Replies
9. Shell Programming and Scripting
I have to redirect STDERR messages both to screen and also capture the same in a file but STDOUT only to the same file.
I have searched in this formum for a solution, but something like
srcipt 3>&1 >&2 2>&3 3>&- | tee errs
doesn't work for me...
Has anyone an idea??? (18 Replies)
Discussion started by: thuranga
18 Replies
10. Shell Programming and Scripting
I cannot figure out what is wrong.... I have 3 files with IP addresses:
file1 134.123.3.236
file2 134.123.3.235
file3 134.123.5.237
I type "prob1 Oops x2x3x4". Then my code creates file with name Oops and first line x2x3x4. Moreover, my code generate IP and it gives to file Oops as a second... (1 Reply)
Discussion started by: Manu1234567
1 Replies
LEARN ABOUT FREEBSD
atf-check
ATF-CHECK(1) BSD General Commands Manual ATF-CHECK(1)
NAME
atf-check -- executes a command and analyzes its results
SYNOPSIS
atf-check [-s qual:value] [-o action:arg ...] [-e action:arg ...] [-x] command
DESCRIPTION
atf-check executes a given command and analyzes its results, including exit code, stdout and stderr.
Test cases must use atf-sh(3)'s atf_check builtin function instead of calling this utility directly.
In the first synopsis form, atf-check will execute the provided command and apply checks specified by arguments. By default it will act as
if it was run with -s exit:0 -o empty -e empty. Multiple checks for the same output channel are allowed and, if specified, their results
will be combined as a logical and (meaning that the output must match all the provided checks).
In the second synopsis form, atf-check will print information about all supported options and their purpose.
The following options are available:
-s qual:value Analyzes termination status. Must be one of:
exit:<value> checks that the program exited cleanly and that its exit status is equal to value. The exit code can be omit-
ted altogether, in which case any clean exit is accepted.
ignore ignores the exit check.
signal:<value> checks that the program exited due to a signal and that the signal that terminated it is value. The signal
can be specified both as a number or as a name, or it can also be omitted altogether, in which case any signal
is accepted.
Most of these checkers can be prefixed by the 'not-' string, which effectively reverses the check.
-o action:arg Analyzes standard output. Must be one of:
empty checks that stdout is empty
ignore ignores stdout
file:<path> compares stdout with given file
inline:<value> compares stdout with inline value
match:<regexp> looks for a regular expression in stdout
save:<path> saves stdout to given file
Most of these checkers can be prefixed by the 'not-' string, which effectively reverses the check.
-e action:arg Analyzes standard error (syntax identical to above)
-x Executes command as a shell command line, executing it with the system shell defined by ATF_SHELL. You should avoid using
this flag if at all possible to prevent shell quoting issues.
EXIT STATUS
atf-check exits 0 on success, and other (unspecified) value on failure.
ENVIRONMENT
ATF_SHELL Path to the system shell to be used when the -x is given to run commands.
EXAMPLES
The following are sample invocations from within a test case. Note that we use the atf_check function provided by atf-sh(3) instead of exe-
cuting atf-check directly:
# Exit code 0, nothing on stdout/stderr
atf_check 'true'
# Typical usage if failure is expected
atf_check -s not-exit:0 'false'
# Checking stdout/stderr
echo foobar >expout
atf_check -o file:expout -e inline:"xx yy
"
'echo foobar ; printf "xx yy
" >&2'
# Checking for a crash
atf_check -s signal:sigsegv my_program
# Combined checks
atf_check -o match:foo -o not-match:bar echo foo baz
SEE ALSO
atf-sh(1)
BSD
October 5, 2014 BSD