What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

octopus

Part of the Furniture
I'm trying to wrap my head around this..... (small head).
Try to have this shorter, have tried several ideas but no success. maybe some have any idea..

Code:
if [ "$vpn" = "route-up" ] && [ "$var" = "client1" ] || [ "$var" = "client2" ] || [ "$var" = "client3" ] || [ "$var" = "client4" ] || [ "$var" = "client5" ]; then"
Tried: if [ "$vpn" = "route-up" ] && [ "$var" = "client[1-5]" ]; then
and that not working.

Thanks
Octtopus
 
I'm trying to wrap my head around this..... (small head).
Try to have this shorter, have tried several ideas but no success. maybe some have any idea..

Code:
if [ "$vpn" = "route-up" ] && [ "$var" = "client1" ] || [ "$var" = "client2" ] || [ "$var" = "client3" ] || [ "$var" = "client4" ] || [ "$var" = "client5" ]; then"
Tried: if [ "$vpn" = "route-up" ] && [ "$var" = "client[1-5]" ]; then
and that not working.

Thanks
Octtopus

Code:
if [ "$vpn" = "route-up" ] && echo "$var" | grep -qwE "client[1-5]"; then
 
What does this do? :)
 
What does this do? :)
Its a shorter expression to this
Code:
if [ "$vpn" = "route-up" ] && [ "$var" = "client1" ] || [ "$var" = "client2" ] || [ "$var" = "client3" ] || [ "$var" = "client4" ] || [ "$var" = "client5" ]; then
 
@octopus, I don't know if you're trying to be funny? :)

I know it's a shorter, expression... but, what does that expression do?
 
@octopus, I don't know if you're trying to be funny? :)

I know it's a shorter, expression... but, what does that expression do?
Don't run that code, it's just a snippet from a larger file ;)
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Members online

Top