shell doubt of for

Issues related to applications and software problems
Post Reply
knzzz
Posts: 157
Joined: 2017/02/25 12:41:42

shell doubt of for

Post by knzzz » 2018/04/14 23:55:36

Hi Team,

I wrote a shell script in which it should repeat a process untill it satisfies the condition using the for loop i wrote the script, my question how can i make sure the process is repeating till the conditions are met.

Regards
Kanna

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: shell doubt of for

Post by lightman47 » 2018/04/15 11:33:31

Throw an echo or print of your test value into the loop to see it changing as it runs?

A Google for bash scripts returned this, and many others ;-)

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: shell doubt of for

Post by hunter86_bg » 2018/04/17 04:05:38

I would use a while script:

Code: Select all

while true
do
    echo test 
done
Or an 'until':

Code: Select all

until [ "$VARIABLE1" -lt "1" ]
do
     echo test
done

Post Reply