0

How to come back in for loop?I'm try to check if condition inside if. if condition is satisfied it goes to if condition.

    a=(1 2 3 4 5 6 7 8 9)

file="/data/dev-staging/Scripts.txt"
dir="/data/test"


for i in ${a[@]} do

        if [ $i = 5 ]; then


                if [ -f "$file" ]; then

                        mv $file $dir
                        continue
                fi

        else


        fi

done

note:- Once the file enter into if condition**(if [ -f "$file" ]; then)** then I want to come back for loop.

suppose I will use continue it goes to first if condition(if [ $i = 5 ]; then).

  • 1
    Possible dupplicate: http://stackoverflow.com/questions/9639103/is-there-a-goto-statement-in-bash – richerlariviere Aug 12 '15 at 19:51
  • BTW, there are unrelated bugs in this code -- consider running things through http://shellcheck.net/ before posting here. The most important thing, though, is that your code doesn't act as a minimal, **complete, verifiable** example of the problem you pose: To be a good question, it needs to actually show your problem when someone else runs it; pseudocode, by definition, can't be run and so doesn't meet this criteria. – Charles Duffy Aug 12 '15 at 19:57
  • See http://stackoverflow.com/help/mcve, or the related guide at http://sscce.org/. – Charles Duffy Aug 12 '15 at 19:57
  • Charles Duffy @ thanks for the reply could you examined now. –  Aug 13 '15 at 05:06

0 Answers0