03-25-2010
optargs processing
Hello i'm writing some analyzing script and i'm giving to my program these parameters, for example:
./procinfo -r tmpfile sh -c "cat tmpfile"
where -r is proccessed in getopts and it takes an argument by OPTARG..
The thing is I need to save this part to some variable:
sh -c "cat tmpfile"
I've tried it as ( after shifting, of course - shift $(($OPTIND - 1)) )
VARIABLE="$*"
or other ways..
$*
$@
"$@"
It only saves the part but WITHOUT the quotation marks and that's why i'm writing here..
Do you know, where the problem could be?
I'm pretty confused by that :/
thanks for answers!
7 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I am sorry if my query is too simple ......
Can anybody explain the usage of optargs in shell script with options having arguments associated with them.
Thanks in advance !!! (8 Replies)
Discussion started by: skyineyes
8 Replies
2. Shell Programming and Scripting
I have a file with header and data rows. I need to remove the header rows from the file and use the data rows for my processing.
The problem is the header is not always constant number of rows. But the only way to identify the last row of the header is that it has
the header information of... (4 Replies)
Discussion started by: dsravan
4 Replies
3. Shell Programming and Scripting
Hello everybody,
I have a little problem with one of my program. I made a plugin for collectd (a stats collector for my servers) but I have a problem to make it run in parallel.
My program gathers stats from logs, so it needs to run in background waiting for any new lines added in the log... (0 Replies)
Discussion started by: Samb95
0 Replies
4. Shell Programming and Scripting
bash-2.05$ vi file_read.sh
"file_read.sh" 9 lines, 97 characters
#!/bin/ksh
print "Enter the group name"
read gname
varA= grep "$gname::" group
print $varA
This is the scenario: I am trying to get a userid and groupname from user and trying to add the userid to the given group.... (11 Replies)
Discussion started by: mnathan
11 Replies
5. IP Networking
I want to know the processing time taken by a node.example suppose a node ges a rreq...then it searched through it's table to see if it has a fresh route or not.I want to know this search time...is their any function available for doing this in ns2 or in glomosim.Any help is highly appreciated ... (1 Reply)
Discussion started by: prashantgolu
1 Replies
6. Programming
Hello,
I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this :
This is the output of ls command : I stored the output in a file filelist
1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies
7. Shell Programming and Scripting
Hi,
I have a file
2013-01-01
2013-01-02
01-03-2013
03-03-2013
mar05
I need all the dates YYYY-MM-DD in a separate file and rest of the things in different file.
File 1:
2013-01-01
2013-01-02
File 2: (8 Replies)
Discussion started by: ATWC
8 Replies
TMPFILE(3) Linux Programmer's Manual TMPFILE(3)
NAME
tmpfile - create a temporary file
SYNOPSIS
#include <stdio.h>
FILE *tmpfile(void);
DESCRIPTION
The tmpfile() function opens a unique temporary file in binary read/write (w+b) mode. The file will be automatically deleted when it is
closed or the program terminates.
RETURN VALUE
The tmpfile() function returns a stream descriptor, or NULL if a unique filename cannot be generated or the unique file cannot be opened.
In the latter case, errno is set to indicate the error.
ERRORS
EACCES Search permission denied for directory in file's path prefix.
EEXIST Unable to generate a unique filename.
EINTR The call was interrupted by a signal.
EMFILE Too many file descriptors in use by the process.
ENFILE Too many files open in the system.
ENOSPC There was no room in the directory to add the new filename.
EROFS Read-only file system.
CONFORMING TO
SVr4, 4.3BSD, C89, C99, SUSv2, POSIX.1-2001.
NOTES
POSIX.1-2001 specifies: an error message may be written to stdout if the stream cannot be opened.
The standard does not specify the directory that tmpfile() will use. Glibc will try the path prefix P_tmpdir defined in <stdio.h>, and if
that fails the directory /tmp.
SEE ALSO
exit(3), mkstemp(3), mktemp(3), tempnam(3), tmpnam(3)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
2008-07-14 TMPFILE(3)