Been sifting through these forums for awhile, but never had an account or needed to post. Shoutouts to a great forum with heaps of useful info.
Now i consider myself a noob when it comes to linux and to bash scripting. I recently started to learn to use Vmware ESX server which uses redhat. Now I wanted to learn how to bash script so i set myself a goal, to write a bash script that would backup some files on the ESX server and then ftp them.
I got a working script going, not very pretty but it worked. I recently made some changes to it and now it isnt doing exactly what i was hoping. Basically I put alot of IF commands in to check if things were on the right track and if they werent they set a variable to 1. The whole script runs under a while loop that checks to see if that variable is 1. If so it stops.
For some reason, now even when i set variable to 1, the loop keeps running till it gets to the end of all the commands. then it stops. So my point is have i done something wrong, or am i misunderstanding how while loops work. Shouldn't it stop the momment its condition is met?
Hoping someone can point me in the right direction.
Dear all
How to write the shell script for the following statement:
(C programming)
for (i=0;i<30;i++) {
if i=1
continue *skip this number
(To do function here....)
...
}
similar statement in while loop....
I wrote the script in sh... (3 Replies)
Hi,
I am facing issues with test condition. I had a compound condition to write for both if and while,
In one of the texts i referred, with a korn shell we can write compound statements like: ], however this doesn't worked for me. For example:
if ] doesn't works, but
if || worked.
... (1 Reply)
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Hi Im running this script, which is supposed to find the max value build some tables and then stop running once all the tables are built. Thing is , it keeps assigning a null value to $h and then $g is null so it keep building tables i.e. testupdateNUL. How can I stop this? Here is what I have:
... (4 Replies)
Hi all
Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Wrote a KSH script on a RHEL server and moved it over to the HPUX server and it is not liking a loop that I put together. Here is the simple form of it that does not work in KSH:
for x in {0..$VARIABLE_NAME}
do
echo $x
done
This works:
for x in {0..10}
do
echo $x
... (3 Replies)
Hello All,
Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....?
I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping
through a string containing some of these "Illegal Characters". Now... (5 Replies)
Hi,
I want to read file multiple times. Right now i am using while loop but that is not working.
ex.
While read line
do
while read line2
do
echo stmt1
#processing some data based on data.,
done < file2.txt
done < file1.txt # This will have 10... (4 Replies)
Hi all,
i developed a script to measure the uptime of a process in a Solaris 10/11 environments.
All is well, but i came across a situation where there are multiple processes of the same name. Basically i have the following result file:
beVWARS 13357 19592122
beVWARS 14329 19591910... (4 Replies)