01-19-2011
Well, if this is C, execl returns an int, and write takes a int fd, char* buffer and size_t length. Can you express your desire in a bit higher language? Maybe you just need system()?
10 More Discussions You Might Find Interesting
1. Programming
Im currently using execl() to run the ls command and redirect the output to a text file. Unfortunately, when I check the text file, no information has been written to it.
I am calling execl() with the ls command like this
execl( "/bin/ls" , "-al" , '>' , "dirlist.txt" ,(char *) 0 );
... (5 Replies)
Discussion started by: JamesGoh
5 Replies
2. Shell Programming and Scripting
When I run <ls -l> to get a list of all the files, I want the displayed result to be written to a text file. Is there a way to do that? (1 Reply)
Discussion started by: kn.naresh
1 Replies
3. Shell Programming and Scripting
hi all,
when i try to start an applicationserver
for an example:
./kStart.sh > out.txt
so kStart.sh script will start the application server and write the details to out.txt
but in mycase... it is writing to out.txt and as well it is showing in the prompt also...
I want only the... (2 Replies)
Discussion started by: raghur77
2 Replies
4. Shell Programming and Scripting
Hi,
I am writing a code where the file is a pipe delimited and I would need to extract the 2nd part of field2 if it is "ATTN", "C/O" or "%" and check to see if field9 is populated or not. If field9 is already populated then leave it as is but if field9 is not populated then take the 2nd part of... (3 Replies)
Discussion started by: msalam65
3 Replies
5. Shell Programming and Scripting
All,
Can anyone please help me with the below scenario in korn shell script.
Can anyone please give me some hints to proceed on this.
I have a Flat file of the below format.
Input file format:... (1 Reply)
Discussion started by: sp999
1 Replies
6. Shell Programming and Scripting
I have a process which writes lots of output to the screen and am capturing it to a file.
But the issue is that there are few lines which repeat every second which is causing the file size to be enormous. I am trying to filter out and then run the command but its not working.
Can you confirm... (7 Replies)
Discussion started by: rajkumarme_1
7 Replies
7. Shell Programming and Scripting
Good morning everybody,
Beeing an absolute newbie in shell scripting I would like to look for some help here.
I would like to read an external text file and format the data and write it to an output file.
What I was trying to do was to display the result (this worked).
But now I... (1 Reply)
Discussion started by: bluejean1976
1 Replies
8. Shell Programming and Scripting
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies
9. Shell Programming and Scripting
hi,
i am trying to write a script to generate ouput in the following format:
##### buildappi abcd_sh nodebug.#####
##### buildappi ijk_sh nodebug.#####
The given string is as follows:
xtopSharedDLLs = "abcd_sh def_sh ijk_sh " \
+ "jkl_sh any_sh... (15 Replies)
Discussion started by: Rashid Khan
15 Replies
10. Shell Programming and Scripting
Hi Linux Experts.
I have a requirement where i need to update the thousands of table definitions to extend the column length and character set therefore i am looking for some sort of linux script which i can use to update the length and chacterset.
I have two files
In first file i have 7... (1 Reply)
Discussion started by: Black-Linux
1 Replies
stdarg(5) File Formats Manual stdarg(5)
NAME
stdarg.h - macros for handling variable argument lists
SYNOPSIS
DESCRIPTION
The header contains a set of macros that can be used to write portable procedures that accept variable argument lists. Routines that have
variable argument lists (such as but do not use stdarg are inherently nonportable, because different machines use different argument-pass-
ing conventions.
is a type defined for the variable used to traverse the list.
is called to initialize pvar to the beginning of the list. The type of argN should be the same as the argument to the function just before
the variable portion of the argument list.
returns the next argument in the list pointed to by pvar. type is the type the argument is expected to be. Different types can be mixed,
but it is up to the routine to know what type of argument is expected, because it cannot be determined at runtime.
is used to clean up.
Multiple traversals, each bracketed by ... are possible.
NOTE: The header file supercedes the header, and contains all of the macros. is provided for compatibility with pre-ANSI compilers and
earlier releases of HP C/HP-UX.
EXAMPLE
This example is a possible implementation of (see exec(2)):
#include <stdarg.h>
#define MAXARGS 100
/* execl is called by
execl(file, arg1, arg2, ..., (char *)0);
*/
execl(const char *file, const char *args, ...)
{
va_list ap;
char *array[MAXARGS];
int argno = 0;
va_start(ap, args);
if ((array[0] = args) != 0)
while ((array[argno++] = va_arg(ap, char *)) != 0)
;
va_end(ap);
return execv(file, array);
}
WARNINGS
It is up to the calling routine to specify how many arguments there are, since it is not always possible to determine this from the stack
frame. For example, is passed a zero pointer to signal the end of the list, and can tell how many arguments are there by the format
string.
Unless ANSI C is used, it is non-portable to specify a second argument of char, short, or float to va_arg, because arguments seen by the
called function are never char, short, or float.
Pre-ANSI C converts char and short arguments to int and converts float arguments to double before passing them to a function.
SEE ALSO
exec(2), vprintf(3S), varargs(5).
STANDARDS CONFORMANCE
stdarg(5)