Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop for loop #8

Open
gregorko opened this issue Feb 3, 2015 · 5 comments
Open

stop for loop #8

gregorko opened this issue Feb 3, 2015 · 5 comments

Comments

@gregorko
Copy link

gregorko commented Feb 3, 2015

I think in Bourne shell the loop for i in {1..10} is not working. At least for me it only goes through once and causes the stop to not wait long enough. Other scripts I looked at tend to use other type of loops.

@dgrant
Copy link

dgrant commented Apr 17, 2015

Same problem here. It's got #!/bin/sh at the top of the script but init v or whatever is running it using bash. Any idea what type of loop we should use instead?

@gregorko
Copy link
Author

I replaced line 47 to line 57 with:

kill `get_pid`
i=0
while is_running; do
  if [ $i = '60' ]; then
    break;
  else
    echo -n "."
    i=$(($i+1))
    sleep 1
  fi
done
echo

Also I raised the max waiting time to 60 seconds

@dgrant
Copy link

dgrant commented Apr 17, 2015

hehe, I did something similar

@dgrant
Copy link

dgrant commented Apr 17, 2015

(and then I call kill -9 if it still doesn't die)

@PLG
Copy link

PLG commented Jun 30, 2015

It is Bourne shell, so I used for i in 1 2 3 4 5 6 7 8 9 instead of for i in {1..10}
http://steve-parker.org/sh/loops.shtml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants