03-15-2014
I don't really understand your question. But there are plenty of getopts examples that have been posted to this site. This thread:
https://www.unix.com/showthread.php?t=3619 has a script I wrote a while back that uses getopts. Does that help?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
my lecturer want to do an assignment about telnet server..first, he want us to download the telnet server..then he want we do about copy files and share files by using the telnet server....what is that??? and one more thing is how to do 'ping'???? (1 Reply)
Discussion started by: amelia
1 Replies
2. UNIX for Dummies Questions & Answers
Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some.
I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies
3. What is on Your Mind?
All Sys Administrators,
With due respect I would like to know what should be BEST Things to
do when LEAVING one job , and what Precaution MUST be taken
while taking over new JOB?? Please Discuss in detail the STEP to be
taken for both the TIME ?? (3 Replies)
Discussion started by: vakharia Mahesh
3 Replies
4. Shell Programming and Scripting
Hi,
I have a program where I want to use getopts.
I want to use "-i" option and then optionally supply arguments.
If user dosent supply arguments, then also it should work.
Please tell me how to proceed.
Here is some code, this is not right code btw but a sample to understand what I want to... (1 Reply)
Discussion started by: som.nitk
1 Replies
5. Programming
after some years of pause, im returning to c.
char *varname = "asd";
int *number = 4;
the above code is wrong, because its assigning a value to an unreserved space, or because its changing the address the pointer is pointing ?
thanks for the replys!! (3 Replies)
Discussion started by: broli
3 Replies
6. Shell Programming and Scripting
Hi all
How do I assign a pattern to a variable after a match is found using a regular expression in PERL?
For example using a regular expression (RE) and matching as given
if ($_ =~ /(?:\s*+\s*,)*\s*+\s*/)
I want to assign the pattern matched by the RE to a variable.
e.g. given the... (4 Replies)
Discussion started by: my_Perl
4 Replies
7. Homework & Coursework Questions
1. List commands
to create the directory hierarchy $HOME/a/b/c
in vi to replace all occurences of TMP with tmp in lines 1 through 10
in vi to replace first occurence of CPU_file with DISK_file at line 15
2. Explain with a very simple example, usage of "ls -a"
3. What do the... (2 Replies)
Discussion started by: jessesaini
2 Replies
8. Shell Programming and Scripting
Q-1
Write a shell script in Unix that lists files from your current working directory
· By modification time when called with lm
· By access time when called with la.
By default, the script should show the listing of all the files in the current directory.
Q-2
Write a... (1 Reply)
Discussion started by: Vishank Parikh
1 Replies
9. Homework & Coursework Questions
Q-1
Write a shell script in Unix that lists files from your current working directory
· By modification time when called with lm
· By access time when called with la.
By default, the script should show the listing of all the files in the current directory.
Q-2
Write a shell script which... (1 Reply)
Discussion started by: Vishank Parikh
1 Replies
10. UNIX for Dummies Questions & Answers
Hello all im currently working on this assignment and a little stump on how to check for an argument heres the instructions:
Step 4:
Modify your script so that if there is an argument called TestError you display the following error message with your usage statement.
TestError found
Example:... (1 Reply)
Discussion started by: bsn3971
1 Replies
LEARN ABOUT REDHAT
mktemp
MKTEMP(3) Linux Programmer's Manual MKTEMP(3)
NAME
mktemp - make a unique temporary file name
SYNOPSIS
#include <stdlib.h>
char *mktemp(char *template);
DESCRIPTION
The mktemp() function generates a unique temporary file name from template. The last six characters of template must be XXXXXX and these
are replaced with a string that makes the filename unique. Since it will be modified, template must not be a string constant, but should be
declared as a character array.
RETURN VALUE
The mktemp() function returns NULL on error (template did not end in XXXXXX) and template otherwise. If the call was successful, the last
six bytes of template will have been modified in such a way that the resulting name is unique (does not exist already). If the call was
unsuccessful, template is made an empty string.
ERRORS
EINVAL The last six characters of template were not XXXXXX.
CONFORMING TO
BSD 4.3. POSIX dictates tmpnam(3).
NOTE
The prototype is in <unistd.h> for libc4, libc5, glibc1; glibc2 follows the Single Unix Specification and has the prototype in <stdlib.h>.
BUGS
Never use mktemp(). Some implementations follow BSD 4.3 and replace XXXXXX by the current process id and a single letter, so that at most
26 different names can be returned. Since on the one hand the names are easy to guess, and on the other hand there is a race between test-
ing whether the name exists and opening the file, every use of mktemp() is a security risk. The race is avoided by mkstemp(3).
SEE ALSO
mkstemp(3), tempnam(3), tmpfile(3), tmpnam(3)
GNU
1993-04-03 MKTEMP(3)