[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: disable IPv6 debian



On Fri, Apr 15, 2022 at 10:34:25AM -0400, Chuck Zmudzinski wrote:
> user@debian:~$ cat ipv6
> #!/bin/bash
> if [ $1 == "on" ]
> then
>         ip -6 route add default via <redacted> dev <redacted>
> elif [ $1 == "off" ]
> then
>         ip -6 route delete default
> fi

Quotes are in the wrong place.  The [ builtin command follows the
ordinary parsing rules, which means an unquoted $1 argument will be
subject to word splitting and filename expansions.

In simpler terms, it will blow up if $1 is empty or contains whitespace
characters or globbing characters.

The quotes need to go around "$1", not around string constants.

if [ "$1" == on ]


Reply to: