0

I am trying to run ~bin/ap script multiple times with

dims@pterosaur:~$ while true; ~bin/ap; sleep 2; done
bash: syntax error near unexpected token `done'

where

dims@pterosaur:~$ cat bin/ap
#!/bin/sh
MAC="$(iwconfig wlp2s0 | sed -n 's/.*Access Point: //p' | xargs)"

if [ "$MAC" = "60:E3:27:8D:AC:F0" ]; then
    MAC="tplink2"
elif [ "$MAC" = "60:E3:27:8D:7A:A6" ]; then
    MAC="tplink1"
fi

echo "[$MAC]"

What's wrong here?

2
  • 6
    missed do after the first ; – Ipor Sircer Nov 7 '16 at 11:54
  • 1
    Should be while true; do "$HOME/bin/ap" … – Costas Nov 7 '16 at 12:28
1

Try (also from @IporSircer comment) this instead:

while true;do~/bin/ap; sleep 2; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.