05-12-2014
You should use the logical operator || instead of &&.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Is there a basic IP range script or a site that has basic script written?
I am making a script that is looking for a device on my network threw HTTP://. I and using a for loop with wget to download the page and using grep to search the code for the serial number.
My range is 172.16.x.x/16 I... (3 Replies)
Discussion started by: captaindoogles
3 Replies
2. Shell Programming and Scripting
I need to create a script that has a user enter a value. I want to verify that the value is either 1,2, or 3. If it is not then I want them to try entering it again. I am using a while loop to force them to retry.
I am able to test the input against 1,2, and 3, but when I test agains an... (4 Replies)
Discussion started by: spartiati
4 Replies
3. Shell Programming and Scripting
Hello All,
I was wondering if it would be possible to create a "racing" game in script. The game play would be as follows. Script will read the following input:
Start
|b| | | | |
|r| | | | |
First player (b) will roll a die to see how many spaces to move. This is will continue until the... (0 Replies)
Discussion started by: jl487
0 Replies
4. Shell Programming and Scripting
Hello,
We have to configure servers with a range of IPs which is in itself a subject for another script assistance request -but- we have run into quite a few IP ranges with routing problems lately.
I've been trying to figure out the best way to test a range of IPs, I mean, manually it's not... (4 Replies)
Discussion started by: boxgoboom
4 Replies
5. UNIX for Advanced & Expert Users
Hello Experts,
I have a script that that transfers a file (via sftp) and it works fine but we ran into a snag where the target server asked for the ssh key and the script didn't know what to do. I want to add some logic to this script that at least sends an email that it didn't complete as... (4 Replies)
Discussion started by: Tiberius777
4 Replies
6. Shell Programming and Scripting
Hi,
I have data in the following form:
AB001 10
AB002 9
AB003 9
etc
AB200 5
What I need to do is sum up the second value according to groups of the first, i.e. AB001 to AB030 the total being X, AB031 to AB050 the total being Y etc (there are 5 AB ranges of different sizes). I'm sure... (3 Replies)
Discussion started by: chrissycc
3 Replies
7. Shell Programming and Scripting
I wrote a script to give a user 5 guesses on what is my favorite color but I it doesn't work. I've only been scripting for a couple weeks and need some help it seems simple but how do I give the user 5 guesses? (3 Replies)
Discussion started by: noob
3 Replies
8. Shell Programming and Scripting
Hi, I have written a script that allows me to repetitively play a music file $N times, which is specified through user input. However, if I want to exit the script before it has finished looping $N times, if I use CTRL+c, I have to CTRL+c however many times are left in order to complete the loop.... (9 Replies)
Discussion started by: hilltop_yodeler
9 Replies
9. Shell Programming and Scripting
I'm working on a new exercise that calls for a script that will take in two arguments on the command line (representing the range of line numbers) and will subsequently print those lines from a a specified file. Command line would look like this: ./lines_script.bash 5 15 <file.txt. The script would... (8 Replies)
Discussion started by: ksmarine1980
8 Replies
10. Shell Programming and Scripting
When I run the following script at the bottom it say cards remaining=44...It should be=35.
Can anyone tell me what I'm doing wrong. I've spent hours trying to get this to work and I can't go any further until this part works. thank you in advance
Cogiz
#!/bin/bash
# Date="November, 2016"
#... (2 Replies)
Discussion started by: cogiz
2 Replies
LEARN ABOUT OPENSOLARIS
mktemp
mktemp(3C) Standard C Library Functions mktemp(3C)
NAME
mktemp - make a unique file name from a template
SYNOPSIS
#include <stdlib.h>
char *mktemp(char *template);
DESCRIPTION
The mktemp() function replaces the contents of the string pointed to by template with a unique file name, and returns template. The string
in template should look like a file name with six trailing 'X's; mktemp() will replace the 'X's with a character string that can be used to
create a unique file name. Only 26 unique file names per thread can be created for each unique template.
RETURN VALUES
The mktemp() function returns the pointer template. If a unique name cannot be created, template points to a null string.
ERRORS
No errors are defined.
EXAMPLES
Example 1 Generate a filename.
The following example replaces the contents of the "template" string with a 10-character filename beginning with the characters "file" and
returns a pointer to the "template" string that contains the new filename.
#include <stdlib.h>
...
char *template = "/tmp/fileXXXXXX";
char *ptr;
ptr = mktemp(template);
USAGE
Between the time a pathname is created and the file opened, it is possible for some other process to create a file with the same name. The
mkstemp(3C) function avoids this problem and is preferred over this function.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO
mkstemp(3C), tmpfile(3C), tmpnam(3C), attributes(5), standards(5)
SunOS 5.11 15 Sep 2004 mktemp(3C)