Man pages....look at the man pages. If you don't have them, you can find them on-line. Read them when you have nothing better to do. Find new commands and new ways of doing things.
The answer:
The only way to direct the standard output and standard
error separately is by invoking... (0 Replies)
Hi everyone,
Simple scripting question here. I have:
#!/bin/csh
if ( -e $HOME/*.core) then
rm -f $HOME/*.core >& /dev/null
else
echo "No core files to delete."
endif
But I keep getting the /home/user/*.core: no match
dialog. How can I suppress this? or, why is... (0 Replies)
Portion of my script below :
if ; then
NUMBEROFFEILDS=`cat ${BASE_SCRIPT_LOC}/standardfilecleanup.lst|grep -w ${db_file_path}|awk -F: '{print NF}'`
COUNT=4
while ; do
awk_var="$"`echo $COUNT`
file_name1=`cat ${BASE_SCRIPT_LOC}/standardfilecleanup.lst|grep -w... (1 Reply)
I am trying to use one global declaration --> "exec 2>$ERR" to capture all stderr outputs that may occur anywhere in my script.
Then close it at the end of the script using --> "exec 2<&-"
I am using KSH on Solaris 8.
KSH Version M-11/16/88i
If I comment two "exec .." statements in the... (11 Replies)
Hello all,
I have a for loop executing in a script that I want to redirect STDOUT to screen and to file, while directing STDERR to the bit bucket. Here is the general sentax of what I'm doing:
for i in thingy
do
some_command ${i}
done 1>&1 | tee ${LOGFILE} 2> /dev/null
What I am... (2 Replies)
Hi all,
can someone help me with the next redirection?
i want to redirect the stdout+stderr of a command to the same file (this i can do by prog &> file)
but in addition i want to redirect only the stderr to a different file.
how can i do this please? (in BASH)
thanks. (4 Replies)
I need to count the number of lines in a .txt file and put it in a variable.
I am using the following code
#!/bin/bash
count = $(wc -l "some file.txt" | awk '{print$1}')
echo $count
It is giving the following error.
line3: count: command not foundWhat am I doing wrong here? :confused: (7 Replies)
I have a simple script which will send a curl request and redirect the output to a log file.
for i in {1..20}
do
curl google.com -is >>log.log &
echo "request # $i" >> log.log
doneAfter it completes the execution, if I run the following command I should see 20 lines because I am printing... (4 Replies)
I'm having a strange problem with basic >& output redirection to a simple log file in csh. When I run this particular output redirection on the command line, it works, but then when I run the same output redirection command >& in my c shell script, I get a blank log file. Nothing is output to the... (5 Replies)
Discussion started by: silencio
5 Replies
LEARN ABOUT HPUX
dtmsglogopenfile
DtMsgLogOpenFile(library call) DtMsgLogOpenFile(library call)
NAME
DtMsgLogOpenFile -- opens a log file
SYNOPSIS
#include <Dt/MsgLog.h>
FILE* DtMsgLogOpenFile(
const char* type,
char** filename_return);
DESCRIPTION
The DtMsgLogOpenFile function calls fopen to open a log file with type open mode. If fopen opens a log file successfully and returns a non-
NULL filename_return, DtMsgLogOpenFile calls malloc to allocate space for filename_return. DtMsgLogOpenFile then copies the log file name
to filename_return.
The caller must use the free function to release the space allocated for filename_return, if it is not NULL. The caller must also close the
file pointer returned by DtMsgLogOpenFile. Use caution in doing this because stderr may be returned.
For a description of the algorithm used to determine the log file to open, see DtMsgLogMessage(3). Note that if a log file cannot be
opened, filename_return will be set to NULL.
ARGUMENTS
type Specifies the file open flag. See fopen(3) for more information.
filename_return
Specifies the variable to receive the returned log file name.
ENVIRONMENT VARIABLES
None.
RESOURCES
None.
ACTIONS /MESSAGES
None.
ERRORS /WARNINGS
None.
EXAMPLES
The following code fragment opens the log file, logs the log file name, closes the file, and frees the space allocated for the file name.
char * log_file;
FILE * fp = DtMsgLogOpenFile ("a+", &log_file);
if (log_file) {
DtMsgLogMessage (argv[0], DtMsgLogInformation,
"The log file name is: %s", log_file);
free (log_file);
}
if (fp && fp != stderr)
fclose (fp);
RETURN VALUE
If DtMsgLogMessage completes successfully, it returns a pointer to the opened log file. If it cannot open a log file, it returns stderr.
FILES
None.
SEE ALSO DtMsgLogMessage(3), DtMsgLogSetHandler(3)
DtMsgLogOpenFile(library call)