I am not familiar with the "- @" semantics in the bash script snippet below, which is located in / etc / bash _completion.d / subversion. I am trying to understand why bash reports "syntax error near unexpected token" ("in this line I have two questions:
Why might bash be unhappy with this statement?
case $prev in # other cases omitted -@(F|-file|-targets)) _filedir return 0; ;; # other cases omitted esac
"@ (...)" here is part of the Bash pattern matching syntax . It is "or", it simply matches one of the listed patterns, separated by pipeline symbols.
; "- @(a | b | c)" "@(- a | -b | -c)", .
(!), Bash extglob. :
extglob
shopt -s extglob
, :
shopt extglob
, , "@(...)" "extglob". :
script .
"@" - , " ". , , , , .
, bash, , :
@(-F|-file|-targets))
... which makes sense, given the other answers here - @ () matches one of the command arguments, and the extra one )is part of the case structure. I just think the dash is in the wrong place.
)