I'm a noob working on a script to take 3 user inputs. One of them is simply a variable: "poolname". The other 2 are cases: "groupa/groupb" and "enable/disable". "groupa" and "groupb" reference 2 files - groupa.txt or groupb.txt. These files simply consist of a list of server IP addresses and port numbers.
Based on the inputs, the script executes a command but, it needs to repeat the command once for each line in "groupa.txt" or "groupb.txt".
I've got the basics of it working, but the problem I'm having is with the loop to execute the command for each line in the list. Should I be doing this with a function or array or something else? Am I going about this all wrong? For now, I have the loop at the "group" case, but the script is not working correctly with the loop there.
Hi,
I'm not sure where to start since I don't know what "b" does and I ignore syntactic sugarlessness. But it feels like You should get along well with something like (skipping syntax check):
This will read every line from the file called either groupa.txt or groupb.txt and run the command b for each line.
Think whole script can be written
I added exit 1 when parameters didn't match script requests.
Think parameter 2 could be "groupa" or "groupb" to transform the
Hello,
I am new to shell scripting and i am trying to figure why is this not working with else statement.
I am searching for every directory in that DIR i am in, however the "else" seems to be triggered whenever the run the script..
Much thanks in advance!
#!/bin/shell
for item in... (3 Replies)
Hi,
I have to insert html frames in for loop.
Here is the code.
for($k=0;$k<3;$k++)
{
print<<HTML;
<html>
<head>
<title>
HTML Horizontal Frames
</title>
</head>
<frameset cols="25%,75%">
<frame src="a.html">
<frame src="b.html">
</frameset> (0 Replies)
I am using a Perl script to open a series of files in a loop, separate the paragraph into lines, and output the lines into a new file. The code works perfectly fine, except when the source file is over a certain size the loop gets stuck and won’t move on to the next file. It still does what it is... (0 Replies)
Hi all! Im trying to get this script to check for folders in a year/month/day folder structure and if the day doesnt exist then it makes the day. It will also make sure all of the days before todays date exist as well. This script assumes that the month and year folder already exist. It works... (3 Replies)
Hello All,
How i can put loop in nawk. what i want is that i define a variable which contain vlaues like var='1 2 3 4 5' and then define for loop which gives vlaue to nawk one by one to varilable inside nawk and then print it.
cat /omp-data/logs/5etr/081121.APX | nawk -v CDNLIST='700 701' '
... (1 Reply)
i have the equation like below
07:35:07 ( AB : 2319f.ab * 22) + ( AB : 2320f.ab * 22.03 ) + ( AB :2321f.ab * 22.07 ) ...... N
i want put ":" as a delimiter and break the equation like below
2319f.ab * 22
2320f.ab *22.03
2321f.ab * 22.07
.
.
N
i know the number of... (1 Reply)
i have got a file where the env command is appended 5 times. i have to now look for the username and display it in the form of
1) PWD=/home/lee.ballancore
2) USER=lee.ballancore
3) MAIL=/var/spool/mail/lee.ballancore
4) LOGNAME=lee.ballancore
5) HOME=/home/lee.ballancore
6)... (1 Reply)
Hi all,
I am trying to write a shell script that will move files from one directory to another, the only thing is I want to to check loads of different source directory and move the files to loads of different directories.
I am totally new to shell scripts but not to UNIX (although I would... (16 Replies)
I having problem when I call this cleanupmenu function within a script. It continuously loops and goes to selection * That wasn't a valid selection. I have to kill it everytime to stop it. What am I doing wrong. I use this function menu in several other scripts and I don't have this problem at... (2 Replies)