[GLLUG] Help with a script..
Jean van Wyngaardt
gabrieldrumming at gmail.com
Mon Jan 6 21:37:47 UTC 2014
Thanks for that. Weirdly the single colon does the trick perfectly.
I think I'll need to spend some more time working on bash scripting in the near future!
Thanks guys.
Jean
Jean van Wyngaardt
07599 428068
info at jeangabriel.co.uk
http://runlevel.co.uk
http://mactribe.co.uk
On 6 Jan 2014, at 21:16, Tom Taylor <tom at tommyt.co.uk> wrote:
> Your issue is that something needs to happen after the "then".
>
> If you are planning on doing something there at some point then just put a pointless command in there (e.g. true), otherwise change the if statement to be the opposite (!=).
>
> On 6 Jan 2014 20:37, "Jean van Wyngaardt" <gabrieldrumming at gmail.com> wrote:
> Thanks Stuart
>
> The error coming up is this:
>
> /home/ladmin/Desktop/vpn.sh: 7: /home/ladmin/Desktop/vpn.sh: Syntax error: "else" unexpected
>
> Appreciate your help on this. Like you say, it probably needs a "do nothing" type entry. What do you suggest?
>
> Jean
>
> Jean van Wyngaardt
>
> 07599 428068
> info at jeangabriel.co.uk
> http://runlevel.co.uk
> http://mactribe.co.uk
>
> On 6 Jan 2014, at 20:27, Stuart Sears <stuart at sjsears.com> wrote:
>
>> On 06/01/14 20:17, Jean van Wyngaardt wrote:
>>> Hey guys
>>>
>>> Working out this VPN script and it won't run because of line 7 (highlighted in bold below). Seeing as my scripting knowledge is limited, I thought I might check with you!
>>
>> for questions like this, it helps enormously if you also paste the error
>> message you receive :)
>>
>>> #!/bin/sh
>>> while [ "true" ]
>>> do
>>> vpnck=$(nmcli con status uuid 3e46a1d0-ab02-4d69-bd36-31dfcc01af6d)
>>> if [[ $vpnck == *cryptocloud* ]]
>>> then
>>
>> Surely there should be something here, no?
>> What do you expect the script to do if this condition is true?
>> Even a "that's okay, do nothing command" would be okay.
>>
>>> else
>>> (sleep 1s && nmcli con up uuid 3e46a1d0-ab02-4d69-bd36-31dfcc01af6d)
>>> fi
>>> sleep 20
>>> done
>>
>> Regards,
>>
>> Stuart
>>
>> --
>> Stuart Sears RHCA etc.
>> "It's today!" said Piglet.
>> "My favourite day," said Pooh.
>>
>> _______________________________________________
>> GLLUG mailing list
>> GLLUG at mailman.lug.org.uk
>> https://mailman.lug.org.uk/mailman/listinfo/gllug
>
>
> _______________________________________________
> GLLUG mailing list
> GLLUG at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/gllug
>
> _______________________________________________
> GLLUG mailing list
> GLLUG at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/gllug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20140106/3eb548b5/attachment.html>
More information about the GLLUG
mailing list