Views:
2,471β
Votes: 2β
Tags:
command-line
syntax
ksh
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/1153463
Title:
Why is a blank required between "[[" and "-e xxx" in ksh?
ID:
/2019/06/24/Why-is-a-blank-required-between-____-and-_-e-xxx_-in-ksh_
Created:
June 24, 2019
Edited: June 24, 2019
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
The space is a deliminator and is required. As you can see from shellcheck
:
$ shellcheck gmail-browse-msgs-algorithm.sh
In gmail-browse-msgs-algorithm.sh line 847:
[[$Today != "${DaysArr[ i + DAY_DELETED_ON_NDX ]}" ]] && continue
^-- SC1035: You need a space after the [[ and before the ]].
(Both ksh and bash support [[
and donβt work without the space. Shellcheck gives exactly that output with similar ksh and bash scripts containing that buggy line.)
Why deliminators are needed has to do with tokens and lexicons.