On 07/10/2016 09:33 AM, Philip Guenther wrote:
[...]
I just ran the line where _dkdev is set and when using the resulting value
with e.g. `echo` it looks like the "??" is expanded by the shell if $_dkdev
is not enclosed in double quotes. This also seems to happen for the test
clause:

Yeah, that's one of the reasons to use [[ ... ]] instead of [ .. ].

I see, didn't know that difference between [ and [[ yet. I mostly use bash and quote string operands in [[ clauses anyhow. Bash's man page is not that clear in this respect compared to pdksh's man page, which explicitly says:

```
[...]
[[ expression ]]
Similar to the test and [ ... ] commands (described later), with the following exceptions:

* Field splitting and file name generation are not performed on arguments.
[...]
```

...as I just found out.



# [ $_dkdev == '??' ]
ksh: [: /dev/pf: unexpected operator/operand

Try:
    [[ $_dkdev == '??' ]]

Note the '??' must remain quoted so that they *aren't* a globbing
pattern for [[ .. ]]'s more powerful == operator...

Agreed, this gives an identical result to using [ and quoting $_dkdev. But for the patch to `/etc/rc` don't forget to add "/dev/" in front of "??" ('??' => '/dev/??'), so the test actually works.

Bye
Frank

Reply via email to