On Wed, Dec 23, 2015 at 11:26:51AM +0100, Bytec GmbH - Helmut Koeberle wrote: > Here is my simple bash script 'tst' that checks wether the first char of > an argument is a slash.
It can be written in a much simpler way: [[ $arg = /* ]] Or: case $arg in /*) ... This part actually does look like a bug, though: > if [ "true" = "true" -a "${h:0:1}" = "/" ]; then echo slash; fi I can reproduce it (in 4.4.0-beta): imadev:~$ h='(nopath)' imadev:~$ [ true = true -a "${h:0:1}" = / ] bash: [: `)' expected, found / That said, one SHOULD NOT use -a in a test or [ command. It's not supported by POSIX any more. If you want compound tests with test/[ you need to use multiple commands: imadev:~$ [ true = true ] && [ "${h:0:1}" = / ] imadev:~$ Support for the legacy -a argument is a bash extension.