diff --git a/ShellScript/test/syntax_test_bash.sh b/ShellScript/test/syntax_test_bash.sh index 03b1ca00ef..a3e436d06e 100755 --- a/ShellScript/test/syntax_test_bash.sh +++ b/ShellScript/test/syntax_test_bash.sh @@ -1,8 +1,9 @@ # SYNTAX TEST "Packages/ShellScript/Bash.sublime-syntax" -#################################################################### -# Comments # -#################################################################### +############################################################################### +# 3.1.3 Comments # +# https://www.gnu.org/software/bash/manual/bash.html#Comments # +############################################################################### # This is a comment. # <- comment.line.number-sign.shell punctuation.definition.comment.shell @@ -95,9 +96,10 @@ $(( )) -#################################################################### -# The basics # -#################################################################### +############################################################################### +# 3.1.2 Quoting # +# https://www.gnu.org/software/bash/manual/bash.html#Quoting # +############################################################################### echo hello, world! #^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call @@ -169,10 +171,13 @@ echo 'no\e$capes\in\$ingle\quotes' # ^ punctuation.definition.string.end.shell echo 'singe\' \\'' -# ^^^^^^^^ meta.string.shell string.quoted.single.shell -# ^^^ - meta.string - string -# ^^ constant.character.escape.shell -# ^^ meta.string.shell string.quoted.single.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^ meta.string.shell string.quoted.single.shell - string.unquoted +# ^ punctuation.definition.string.begin.shell +# ^^ - constant +# ^ - string +# ^^ constant.character.escape.shell - string.quoted +# ^^ meta.string.shell string.quoted.single.shell - string.unquoted # ^ - meta.string - string echo $'\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z\'' @@ -395,9 +400,10 @@ $e'ch'o Hello, world! # ^ punctuation.definition.string.end.shell -#################################################################### -# Basic Command Arguments # -#################################################################### +############################################################################### +# 3.2 Shell Commands (Basic Command Arguments) # +# https://www.gnu.org/software/bash/manual/bash.html#Simple-Commands # +############################################################################### set -e - # ^ variable.parameter.option.shell punctuation.definition.parameter.shell @@ -701,1763 +707,1863 @@ cd foo/bar2345 #^ meta.function-call.identifier.shell support.function.cd.shell # ^^^^^^^^^^^^ meta.function-call.arguments.shell - constant.numeric -#################################################################### -# Compound Command Arguments # -#################################################################### - -(foo) -o -# <- meta.compound.shell punctuation.section.compound.begin.shell -#^^^ meta.compound.shell meta.function-call.identifier.shell variable.function.shell -# ^ meta.compound.shell punctuation.section.compound.end.shell -# ^^^ meta.compound.arguments.shell -{ foo -o } --opt -- --no-option -# <- meta.compound.shell punctuation.section.compound.begin.shell -#^^^^^^^^^ meta.compound.shell - meta.compound meta.compound -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell - meta.compound meta.compound -# ^ - meta.compound -# ^^^ variable.function.shell -# ^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell -# ^ meta.parameter.option.shell variable.parameter.option.shell - punctuation -# ^ punctuation.section.compound.end.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell - punctuation -# ^^ keyword.operator.end-of-options.shell -# ^^^^^^^^^^^ - variable - punctuation +############################################################################### +# 3.2.3 Pipelines # +# https://www.gnu.org/software/bash/manual/bash.html#Pipelines # +############################################################################### -{ -# <- meta.compound.shell punctuation.section.compound.begin.shell -#^ meta.compound.shell - meta.compound meta.compound - { -#^ meta.compound.shell - meta.compound meta.compound -# ^^ meta.compound.shell meta.compound.shell -# ^ punctuation.section.compound.begin.shell - foo args -#^^^^^^^^^^^^ meta.compound.shell meta.compound.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^^^^ meta.function-call.arguments.shell - } 2>> "$stderr_log" -#^^ meta.compound.shell meta.compound.shell -# ^^^^^^^^^^^^^^^^^^ meta.compound.shell meta.compound.arguments.shell -# ^ meta.compound.shell - meta.compound meta.compound -# ^ punctuation.section.compound.end.shell - # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function -} 1>> "$stdout_log" -# <- meta.compound.shell - meta.compound meta.compound -#^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell -# ^ - meta -# <- punctuation.section.compound.end.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function +cmd1 --opt1 arg1 | cmd2 --opt2 arg2 | cmd3 --opt3 arg3 +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +C2=c2 C3=c3 C4=c4 +c1 -c1 c1 && ${C2} -c2 c2 || c3 -c3 ${C3} ; c4 -${C4} c4 | c5 -c5 c5 +#^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell meta.interpolation.parameter.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable.parameter +# ^ punctuation.terminator.statement.shell +# ^^ variable.function +# ^ variable.parameter -#################################################################### -# 3.2.5 Coprocesses # -#################################################################### -coproc -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell keyword.declaration.coproc.shell -# ^ - meta.coproc - keyword +############################################################################### +# 3.2.5 Compound Commands # +# 3.2.5.1 Looping Constructs (for loops) # +# https://www.gnu.org/software/bash/manual/bash.html#index-for # +############################################################################### -coproc na\ -me args -# <- meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call +for; +#^^ keyword.control.loop.for.shell +for& +#^^ keyword.control.loop.for.shell +for| +#^^ keyword.control.loop.for.shell +for>/dev/null +#^^ keyword.control.loop.for.shell +for - +#^^ keyword.control.loop.for.shell +for() +#^^ keyword.control.loop.for.shell +for[] +#^^^^ - keyword.control +for{} +#^^^^ - keyword.control +for- +#^^^ - keyword.control +-for +#^^^ - keyword.control +for+ +#^^^ - keyword.control +for$ +#^^^ - keyword.control +for$var +#^^^^^^ - keyword.control +for= +#^^^ - keyword.control +for-= +#^^^^ - keyword.control +for+= +#^^^^ - keyword.control -coproc name ar\ -gs -# <- meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call + do; +#^^ keyword.control.loop.do.shell + do& +#^^ keyword.control.loop.do.shell + do| +#^^ keyword.control.loop.do.shell + do>/dev/null +#^^ keyword.control.loop.do.shell + do - +#^^ keyword.control.loop.do.shell + do() +#^^ keyword.control.loop.do.shell + do[] +#^^^^ - keyword.control + do{} +#^^^^ - keyword.control + do- +#^^^ - keyword.control + -do +#^^^ - keyword.control + do+ +#^^^ - keyword.control + do$ +#^^^ - keyword.control +do$var +#^^^^^^ - keyword.control + do= +#^^^ - keyword.control + do-= +#^^^^ - keyword.control + do+= +#^^^^ - keyword.control -coproc sed s/^/foo/ -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell - meta.function-call -# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call -#^^^^^ keyword.declaration.coproc.shell -# ^^^ variable.function.shell +for done +# <- keyword.control.loop.for.shell +#^^ keyword.control.loop.for.shell +# ^^^^ keyword.control.loop.end.shell -coproc ls thisfiledoesntexist; read; 2>&1 -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell -# ^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^^ meta.coproc.command.shell - meta.function-call.identifier.shell -# ^^^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^ meta.coproc.command.shell - meta.function-call.identifier.shell -# ^ - meta.coproc -#^^^^^ keyword.declaration.coproc.shell -# ^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ support.function.read.shell -# ^ punctuation.terminator.statement.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +for do done +# <- keyword.control.loop.for.shell +#^^ keyword.control.loop.for.shell +# ^^ keyword.control.loop.do.shell +# ^^^^ keyword.control.loop.end.shell -coproc awk '{print "foo" $0;fflush()}' -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell -# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call -#^^^^^ keyword.declaration.coproc.shell -# ^^^ variable.function.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell string.quoted.single.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell +for x; do +#<- keyword.control.loop.for.shell +#^^ keyword.control.loop.for.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.loop.do.shell + echo "${!x}" +# ^^^^ meta.function-call.identifier.shell support.function.echo.shell +# ^^^^^^^^ meta.function-call.arguments.shell +done +#<- keyword.control.loop.end.shell -coproc { ls thisfiledoesntexist; read; 2>&1 } | foo -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell -# ^^^^^^ meta.coproc.command.shell - meta.compound -# ^ - meta.function-call - meta.function.coproc -# ^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ - meta.function-call.identifier.shell -# ^^^^ meta.function-call.identifier.shell -# ^^^^^^^^ - meta.function-call.identifier.shell -#^^^^^ keyword.declaration.coproc.shell -# ^ punctuation.section.compound.begin.shell -# ^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ support.function.read.shell -# ^ punctuation.terminator.statement.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.section.compound.end.shell -# ^ keyword.operator.assignment.pipe.shell -# ^^^ variable.function.shell +for (( i = 0; i < 10; i++ )); do +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell +# <- keyword.control.loop.for.shell +# ^^ punctuation.section.arithmetic.begin.shell +# ^ keyword.operator.assignment.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation +# ^ punctuation.terminator.statement.shell +# ^ keyword.operator.comparison.shell +# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.operator.arithmetic.shell +# ^^ punctuation.section.arithmetic.end.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.loop.do.shell + echo $i + # <- meta.function-call support.function.echo.shell + # ^ meta.function-call.arguments punctuation.definition.variable.shell + # ^ meta.function-call.arguments variable.other.readwrite.shell +done +# <- keyword.control.loop.end.shell -coproc myls { ls thisfiledoesntexist; read; 2>&1 } | foo -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^^^^^^ meta.coproc.identifier.shell - meta.compound -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell -# ^^^ - meta.function-call -# ^^^ meta.function-call.identifier.shell -#^^^^^ keyword.declaration.coproc.shell -# ^ punctuation.section.compound.begin.shell -# ^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ support.function.read.shell -# ^ punctuation.terminator.statement.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.section.compound.end.shell -# ^ keyword.operator.assignment.pipe.shell -# ^^^ variable.function.shell +for (( i = 0; i < 10; i++ )) #; do +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell +# <- keyword.control.loop.for.shell +# ^^ punctuation.section.arithmetic.begin.shell +# ^ keyword.operator.assignment.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation +# ^ punctuation.terminator.statement.shell +# ^ keyword.operator.comparison.shell +# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.operator.arithmetic.shell +# ^^ punctuation.section.arithmetic.end.shell +# ^^^^^^ comment.line.number-sign.shell +do +#<- keyword.control.loop.do.shell + echo $i + # <- meta.function-call support.function.echo.shell + # ^ meta.function-call.arguments punctuation.definition.variable.shell + # ^ meta.function-call.arguments variable.other.readwrite.shell +done +# <- keyword.control.loop.end.shell -{ coproc tee { tee logfile ;} >&3 ;} 3>&1 -# <- meta.compound.shell punctuation.section.compound.begin.shell -# ^^^^^^ meta.compound.shell meta.coproc.shell -# ^^^^^ meta.compound.shell meta.coproc.identifier.shell -# ^^^^^^^^^^^^^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.shell -# ^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.arguments.shell -# ^^^ meta.compound.shell - meta.coproc -# ^^^^^ meta.compound.arguments.shell - meta.coproc - meta.function-call -# ^^^^^^ keyword.declaration.coproc.shell -# ^^^ entity.name.function.shell -# ^ punctuation.section.compound.begin.shell -# ^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.assignment.redirection -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.section.compound.end.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +for i in str1 $str2 "str3" 'str4' st$r5; do echo $i; done; +# <- keyword.control.loop.for.shell +# ^ variable.other.readwrite.shell +# ^^ keyword.control.in.shell +# ^^^^ meta.string.shell string.unquoted.shell +# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^^^^^ meta.string.shell string.quoted.double.shell +# ^^^^^^ meta.string.shell string.quoted.single.shell +# ^^ meta.string.shell string.unquoted.shell +# ^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.loop.do.shell +# ^^^^ meta.function-call.identifier.shell support.function.echo.shell +# ^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.loop.end.shell +# ^ punctuation.terminator.statement.shell -coproc foobar { -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^^^^^^^^ meta.coproc.identifier.shell -# ^^ meta.coproc.command.shell meta.compound.shell -#^^^^^ keyword.declaration.coproc.shell -# ^^^^^^ entity.name.function.shell -# ^ punctuation.section.compound.begin.shell - read -#^^^^^^^^ meta.coproc.command.shell meta.compound.shell -# ^^^^ meta.coproc.command.shell meta.compound.shell meta.function-call.identifier.shell support.function.read.shell -} -# <- meta.coproc.command.shell meta.compound.shell punctuation.section.compound.end.shell -#^ - meta +for i in /dev/null +#^^ keyword.control.conditional.if.shell + if - +#^^ keyword.control.conditional.if.shell + if- +#^^^ - keyword.control + -if +#^^^ - keyword.control + if+ +#^^^ - keyword.control + if$ +#^^^ - keyword.control + if$var +#^^^^^^ - keyword.control + if= +#^^^ - keyword.control + if-= +#^^^^ - keyword.control + if+= +#^^^^ - keyword.control + if() +#^^ keyword.control.conditional.if.shell + if[] +#^^^^ - keyword.control + if{} +#^^^^ - keyword.control -function [] () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from []" -} -# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell -[] -# <- meta.function-call.identifier.shell variable.function.shell -#^ meta.function-call.identifier.shell variable.function.shell + then; +#^^^^ keyword.control.conditional.then.shell + then& +#^^^^ keyword.control.conditional.then.shell + then| +#^^^^ keyword.control.conditional.then.shell + then>/dev/null +#^^^^ keyword.control.conditional.then.shell + then - +#^^^^ keyword.control.conditional.then.shell + then- +#^^^^^ - keyword.control +- then +#^^^^^ - keyword.control + then+ +#^^^^^ - keyword.control + then$ +#^^^^^ - keyword.control + then$var +#^^^^^^^^ - keyword.control + then= +#^^^^^ - keyword.control + then-= +#^^^^^^ - keyword.control + then+= +#^^^^^^ - keyword.control + then() +#^^^^ keyword.control.conditional.then.shell + then[] +#^^^^^^ - keyword.control + then{} +#^^^^^^ - keyword.control -function [[]] () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from [[]]" -} -[[]] -# <- meta.function-call.identifier.shell variable.function.shell +if cmd && \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if cmd && + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if cmd || \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if cmd || + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if !cmd +# ^ punctuation.definition.history.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +! cmd +# <- keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +!cmd +# <- punctuation.definition.history.shell #^^^ meta.function-call.identifier.shell variable.function.shell - -function {} () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from {}" -} -{} -# <- meta.function-call.identifier.shell variable.function.shell -#^ meta.function-call.identifier.shell variable.function.shell - -function {{}} () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from {{}}" -} -{{}} -# <- meta.function-call.identifier.shell variable.function.shell +! \ +# <- keyword.operator.logical.shell +# ^ punctuation.separator.continuation.line.shell +! \ + cmd #^^^ meta.function-call.identifier.shell variable.function.shell - -function -foo () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from -foo" -} --foo -# <- meta.function-call.identifier.shell variable.function.shell +!\ +# <- punctuation.definition.history.shell +#^ punctuation.separator.continuation.line.shell +!\ + cmd #^^^ meta.function-call.identifier.shell variable.function.shell +!! +# <- variable.language.history.shell punctuation.definition.history.shell +#^ variable.language.history.shell +!-1 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell +!51 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell -function +foo () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from +foo" -} -+foo -# <- meta.function-call.identifier.shell variable.function.shell -#^^^ meta.function-call.identifier.shell variable.function.shell +[ ] +# <- support.function.test.begin.shell +# ^ support.function.test.end.shell -function =foo () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from =foo" -} -=foo -# <- meta.function-call.identifier.shell variable.function.shell -#^^^ meta.function-call.identifier.shell variable.function.shell +[ +] +# <- meta.conditional.shell support.function.test.end.shell -function fo${bar}'baz' () {} -# ^^^ meta.function.identifier.shell - meta.interpolation - meta.string -# ^^^^^^ meta.function.identifier.shell meta.interpolation.parameter.shell - meta.string -# ^^^^^ meta.function.identifier.shell meta.string.shell - meta.interpolation -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -# ^^ entity.name.function.shell -# ^^^^^^ - entity.name -# ^^^^^ entity.name.function.shell +! [ ] +# <- keyword.operator.logical.shell +# ^ support.function.test.begin.shell +# ^ support.function.test.end.shell -# Functions may replace booleans. Won't respect that in function calls though. -function true () {} ; function false () {} -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^^ meta.function.shell -# ^^ - meta.function -# ^^^^^^^^ meta.function.shell -# ^^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -# ^^^^ entity.name.function.shell -# ^^^^^ entity.name.function.shell -# ^ punctuation.terminator.statement.shell +![ ] +# <- punctuation.definition.history.shell +#^ support.function.test.begin.shell +# ^ support.function.test.end.shell -__git_aliased_command () -{ - local word cmdline=$(__git config --get "alias.$1") - for word in $cmdline; do - case "$word" in - {) : skip start of shell helper function ;; -# ^ - punctuation.section.interpolation.begin -# ^ keyword.control.conditional.patterns.end.shell - \'*) : skip opening quote after sh -c ;; - *) - echo "$word" - return - esac - done -} -# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell -#^ - meta.function +[[ ]] +# <- support.function.test.begin.shell +#^ support.function.test.begin.shell +# ^^ support.function.test.end.shell -# <- - meta.function +[[ +]] +# <- meta.conditional.shell support.function.test.end.shell +#^ meta.conditional.shell support.function.test.end.shell +! [[ ]] +# <- keyword.operator.logical.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell -#################################################################### -# alias builtin # -#################################################################### +![[ ]] +# <- punctuation.definition.history.shell +#^^^^^ meta.conditional.shell +#^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell -alias -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^ - meta.declaration.alias - storage +[[ ! ($line == ^0[1-9]$) ]] +# <- meta.conditional.shell - meta.group +#^^^^ meta.conditional.shell - meta.group +# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp +# ^^^^^^^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell +# ^ meta.conditional.shell meta.group.shell - meta.string +# ^^^ meta.conditional.shell - meta.group +# -alias foo=bar -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ ! ($line != \() ]] +# <- meta.conditional.shell - meta.group +#^^^^ meta.conditional.shell - meta.group +# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp +# ^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell constant.character.escape.shell +# ^ meta.conditional.shell meta.group.shell - meta.string +# ^^^ meta.conditional.shell - meta.group +# -alias f'o'o=bar -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^^^^ meta.variable.shell entity.name.function.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ '-e' == -e ]] # -e undergoes pattern matching on the right +# ^^^^ meta.string.shell string.quoted.single.shell +# ^^ keyword.operator.comparison.shell +# ^^ meta.conditional.shell meta.string.regexp.shell - variable -alias -p foo=bar 7za=qux -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ -e == -e ]] # a syntax error in bash but allowed in zsh +# ^^ - variable.parameter.option +# ^^ keyword.operator.comparison.shell +# ^^ meta.conditional.shell meta.string.regexp.shell - variable -alias -a -p -- foo=bar baz=qux -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^ invalid.illegal.parameter.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ keyword.operator.end-of-options.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ $foo == 'bar' || $foo == "baz" && $bar == baz ]] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.regexp.shell +# ^^ support.function.test.end.shell -alias $foo=bar -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ ( $foo == 'bar' || $foo == "baz" ) && $bar == baz ]] +# <- meta.conditional.shell support.function.test.begin.shell +#^^ meta.conditional.shell - meta.group +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell meta.group.shell +# ^^^^^^^^^^^^^^^^^^ meta.conditional.shell - meta.group +# ^ punctuation.section.group.begin.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^ punctuation.section.group.end.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.regexp.shell +# ^^ support.function.test.end.shell -alias ..='cd ..' -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^ meta.string.shell string.quoted.single.shell +if [[ expr ]] && [[ expr ]] || [[ expr ]] ; then cmd ; fi +# ^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell -alias -p ..='cd ..' -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^ meta.string.shell string.quoted.single.shell +if [[ expr && expr || expr ]] ; then cmd ; fi +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell -alias -- -='cd -' -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^^ keyword.operator.end-of-options.shell -# ^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^ meta.string.shell string.quoted.single.shell - - -#################################################################### -# declare builtin # -#################################################################### - -declare # comment -#<- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^ - meta.declaration.variable -# ^^^^^^^^^^ comment.line.number-sign.shell - -declare foo # 'foo' is a variable name -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ - variable.other.readwrite -# ^ - meta.declaration.variable +if [[ expr && ( expr || expr ) ]] ; then cmd ; fi +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^^^^^^^^^^^^ meta.group.shell +# ^^ support.function.test.begin.shell +# ^^ keyword.operator.logical.shell +# ^ punctuation.section.group.begin.shell +# ^^ keyword.operator.logical.shell +# ^ punctuation.section.group.end.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell -declare +A # this is a comment -#^^^^^^ meta.declaration.variable.shell -# ^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# ^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +if [[ $- =~ *i* ]] ; then echo shell is not interactive; fi +#^ keyword.control.conditional.if.shell +# ^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^^^^^ - meta.string.regexp +# ^^^ meta.string.regexp.shell +# ^^^ - meta.string.regexp +# ^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ support.function.test.begin.shell +# ^^ meta.interpolation.parameter.shell variable.language.shell +# ^ punctuation.definition.variable.shell +# ^^ keyword.operator.comparison.shell +# ^ invalid.illegal.unexpected-quantifier.regexp.shell +# ^ keyword.operator.quantifier.regexp.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^^^^ support.function.echo.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -declare -A foo bar # 'foo' and 'bar' are variable names -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +if [[ "$ERL_TOP" != ";"; ]];then;fi +#^ keyword.control.conditional.if.shell +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^^^^^^^^^^^^^ - meta.string.regexp +# ^^^^ meta.string.regexp.shell +# ^^^ - meta.string.regexp +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -declare -I foo -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^ meta.declaration.variable.arguments.shell -# ^^ variable.parameter.option.shell -# ^^^ variable.other.readwrite.shell +if [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; then PLATFORM=docker; fi +#^ keyword.control.conditional.if.shell +# ^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.identifier.shell variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string string.unquoted.shell -declare ret; bar=foo # comment -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ punctuation.terminator.statement.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ - meta.string - string - comment -# ^^^^^^^^^^ comment.line.number-sign.shell +if { [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; }; then PLATFORM=docker; fi +#^ keyword.control.conditional.if.shell +# ^ punctuation.section.compound.begin.shell +# ^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.identifier.shell variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string string.unquoted.shell -declare ret ; -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ punctuation.terminator.statement.shell +if ( [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2 ); then PLATFORM=docker; fi +#^ keyword.control.conditional.if.shell +# ^ punctuation.section.compound.begin.shell +# ^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.identifier.shell variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string string.unquoted.shell -declare ret& -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ keyword.operator +if [ ! -f q4m-$Q4MVER.tar.gz ]; then +# ^ support.function.test.begin.shell +# ^ keyword.operator.logical.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +# ^ - keyword.operator +# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell + : +# ^ meta.function-call.identifier.shell support.function.colon.shell +fi +# <- keyword.control.conditional.end.shell -declare ret & -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ keyword.operator +if true ; then false ; fi +#^ keyword.control.conditional.if.shell +# ^^^^ constant.language.boolean.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^^^^^ constant.language.boolean.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -declare bar=\ -foo # comment -# <- meta.declaration.variable.arguments.shell meta.string.shell string.unquoted.shell -#^^ meta.declaration.variable.arguments.shell meta.string.shell string.unquoted.shell -# ^ - meta.function -# ^^^^^^^^^^ comment.line.number-sign.shell +if (ruby extconf.rb && +# ^ punctuation.section.compound.begin.shell + { make clean || true; } && + # <- punctuation.section.compound.begin.shell + # ^ punctuation.section.compound.end.shell + make) 1> build.log 2>&1 + # ^ punctuation.section.compound.end.shell + # ^ - variable.function +fi -declare bar=\ -(foo) # comment -#^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.function -# <- punctuation.section.sequence.begin.shell -# ^ punctuation.section.sequence.end.shell -# ^^^^^^^^^^ comment.line.number-sign.shell +if [ "$1" != "" -a "$2" != "" ]; then +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +#^ keyword.control.conditional.if.shell +# <- keyword.control.conditional.if.shell +# ^ support.function.test.begin.shell +# ^^ keyword.operator.comparison.shell +# ^^ meta.conditional.shell variable.parameter.option.shell +# ^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell + local DIR=$1 + # <- keyword.declaration.variable.shell + # ^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^ variable.other.readwrite.shell + local TARGET=$2 + # <- keyword.declaration.variable.shell + # ^^^^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^ variable.other.readwrite.shell +elif [ "$1" ]; then +# <- keyword.control.conditional.elseif.shell +# ^^^^^^^^ meta.conditional.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell + local DIR=$PWD + # <- keyword.declaration.variable.shell + # ^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^^^ variable.other.readwrite.shell + local TARGET=$1 + # <- keyword.declaration.variable.shell + # ^^^^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^ variable.other.readwrite.shell +fi +# <- keyword.control.conditional.end.shell -declare -a owners=( - # dogs -# ^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell comment.line.number-sign.shell - [susan]=labrador -# ^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell -# ^^^^^^^ meta.brackets.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^ meta.string.shell string.unquoted.shell - # cats -# ^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell comment.line.number-sign.shell - [terry]=tabby -# ^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell -# ^^^^^^^ meta.brackets.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ meta.string.shell string.unquoted.shell -) +asdf foo && FOO=some-value pwd +# <- meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^^^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^^^^ meta.string.shell string.unquoted.shell +# ^^^ meta.function-call.identifier.shell support.function.pwd.shell -declare -f _init_completion > /dev/null && complete -F _upto upto -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^ - meta.declaration - meta.function-call -# ^^^^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option.shell -# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell -# ^ keyword.operator.assignment.redirection.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^ variable.function.shell -# ^^ variable.parameter.option.shell +(cd Layer1-linux && PLATFORM=${PLATFORM} ./build ) && +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +(cd Layer2-nodejs && PLATFORM=${PLATFORM} ./build ) && +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +(cd Layer3-base && PLATFORM=${PLATFORM} ./build ) && +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +(cd Layer4-custom && PLATFORM=${PLATFORM} name=${NOSN} ./build ) || err $? +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^^ meta.function-call.arguments.shell +# ^^ variable.language.shell -printFunction "$variableString1" "$(declare -p variableArray)" -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ punctuation.section.interpolation.begin.shell -# ^^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option -# ^^^^^^^^^^^^^ variable.other.readwrite -# ^ punctuation.section.interpolation.end.shell -# <- - variable.other -printFunction "$variableString1" "`declare -p variableArray`" -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ punctuation.section.interpolation.begin.shell -# ^^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option -# ^^^^^^^^^^^^^ variable.other.readwrite -# ^ punctuation.section.interpolation.end.shell +############################################################################### +# 3.2.5 Compound Commands # +# 3.2.5.2 Conditional Constructs (Case Statements) # +# https://www.gnu.org/software/bash/manual/bash.html#index-case # +############################################################################### +case- +# <- - keyword +#^^^^ - keyword -#################################################################### -# Exec builtins # -#################################################################### +esac +# <- keyword.control.conditional.end.shell +#^^^ keyword.control.conditional.end.shell - meta.conditional.case -exec -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell support.function.exec.shell +case +# <- meta.conditional.case.shell keyword.control.conditional.case.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.case.shell -exec -- -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -#^^^ support.function.exec.shell -# ^^^ meta.function-call.arguments.shell -# ^^ keyword.operator.end-of-options.shell +esac +# <- meta.conditional.case.shell keyword.control.conditional.end.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -exec 3<&- -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^^^^^ meta.function-call.arguments.shell -#^^^ support.function.exec.shell -# ^ constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ punctuation.terminator.file-descriptor.shell +case var in + ( patt ( esac +#^ meta.conditional.case.shell +# ^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.group +# ^^ meta.conditional.case.clause.patterns.shell meta.group.regexp.shell +# ^^^^ meta.conditional.case.shell +# ^ keyword.control.conditional.patterns.begin.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +# ^ - meta.conditional -exec -- foo bar -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^^^ meta.function-call.arguments.shell -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -#^^^ support.function.exec.shell -# ^^ keyword.operator.end-of-options.shell -# ^^^ variable.function.shell -exec -c -l -a name git status -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ meta.function-call.identifier.shell -# ^^^^^^^ meta.function-call.arguments.shell -# <- support.function.exec.shell -#^^^ support.function.exec.shell -# ^^ variable.parameter.option.shell -# ^^ variable.parameter.option.shell -# ^^ variable.parameter.option.shell -# ^^^^ meta.string.shell string.unquoted.shell -# ^^^ variable.function.shell +case # comment +#^^^^^^^^^^^^^^^^ meta.conditional.case.shell +#^^^ keyword.control.conditional.case.shell +# ^^^^^^^^^^ comment.line.number-sign.shell + var # comment +#^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# ^^^^^^^^^^ comment.line.number-sign.shell + in # comment +#^^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# ^^ keyword.control.in.shell +# ^^^^^^^^^^ comment.line.number-sign.shell + pattern) # comment +#^ meta.conditional.case.shell +# ^^^^^^^^ meta.conditional.case.clause.patterns.shell +# ^^^^^^^^^^^ meta.conditional.case.clause.commands.shell +# ^^^^^^^^^^ comment.line.number-sign.shell +esac +# <- meta.conditional.case.shell keyword.control.conditional.end.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -exec -la name -i --bar -- foo bar -#^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -#^^^ support.function.exec.shell -# ^^^ variable.parameter.option.shell -# ^^^^ string.unquoted.shell -# ^^ invalid.illegal.parameter.shell -# ^^^^^ invalid.illegal.parameter.shell -# ^^ keyword.operator.end-of-options.shell -# ^^^ variable.function.shell -exec -al name -#^^^ meta.function-call.identifier.shell -# ^^^^^ meta.function-call.arguments.shell -# ^^^^ meta.function-call.identifier.shell -#^^^ support.function.exec.shell -# ^^^ invalid.illegal.parameter.shell -# ^^^^ variable.function.shell +case "$1" in +# <- keyword.control.conditional.case.shell +#^^^ keyword.control.conditional.case.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell punctuation.definition.variable.shell +# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^^ keyword.control.in.shell +setup ) +# <- - variable.function - support.function - meta.function-call +# ^ keyword.control.conditional.patterns.end.shell +echo Preparing the server... +# <- meta.function-call support.function.echo +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +dep\ +loy ) +# <- - variable.function - support.function - meta.function-call +# ^ keyword.control.conditional.patterns.end.shell +echo Deploying... +# <- meta.function-call support.function.echo +# ^^^^^^^^^^^^^ meta.function-call.arguments +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +* ) +# <- constant.other.wildcard.asterisk.shell +# ^ keyword.control.conditional.patterns.end.shell +cat <<'ENDCAT' +# <- meta.function-call.identifier.shell variable.function.shell +# ^^ meta.function-call.arguments.shell - meta.string - meta.tag +# ^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^ keyword.operator.assignment.redirection.shell +# ^ punctuation.definition.tag.begin.shell - entity +# ^^^^^^ entity.name.tag.heredoc.shell +# ^ punctuation.definition.tag.end.shell - entity -exec git diff-index --check --cached $against -- -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^ meta.function-call.arguments.shell -# ^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# <- support.function.exec.shell -#^^^ support.function.exec.shell -# ^^^ variable.function.shell -# ^^^^^^^ variable.parameter.option.shell -# ^^^^^^^^ variable.parameter.option.shell -# ^^ keyword.operator.end-of-options.shell +foo +# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell +ENDCAT +# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +esac +# <- meta.conditional.case.shell keyword.control.conditional.end.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -exec "$cmd" \ -#^^^ meta.function-call.identifier.shell -# ^ meta.function-call.arguments.shell -# ^^^^^^ meta.function-call.identifier.shell meta.string.shell -# ^^^ meta.function-call.arguments.shell -# ^^ punctuation.separator.continuation.line.shell -exec "$cmd" \ - $opts \ -#^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ punctuation.separator.continuation.line.shell +case "${foo}" in- in_ in=10 in +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# <- keyword.control.conditional.case.shell +#^^^ keyword.control.conditional.case.shell +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ keyword.control.in + ( help | h ) bar ;; +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin.shell + # ^ keyword.control.conditional.patterns.end.shell + # ^^ punctuation.terminator.case.clause.shell + do1 ) foo1 ;& +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # ^ keyword.control.conditional.patterns.end.shell + # ^^ punctuation.terminator.case.clause.shell + (do2 ) foo2 ;;& +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin.shell + # ^ keyword.control.conditional.patterns.end.shell + # ^^^ punctuation.terminator.case.clause.shell + *) bar +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell + #^ keyword.control.conditional.patterns.end.shell +esac +# <- keyword.control.conditional.end.shell -exec "$cmd" \ - $opts \ - --cmd-flag -#^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +case $TERM in + sun-cmd) + # ^ keyword.control.conditional.patterns.end.shell + update_terminal_cwd() { print -Pn "\e]l%~\e\\" };; + # ^ meta.function punctuation.section.compound.end.shell + # ^^ punctuation.terminator.case.clause.shell + *xterm*|rxvt|(dt|k|E)term) + # ^ constant.other.wildcard.asterisk.shell + # ^ keyword.operator.logical.regexp.shell + # ^ keyword.operator.logical.regexp.shell + # ^ punctuation.definition.group.begin.regexp.shell + # ^ keyword.operator.logical.regexp.shell + # ^ keyword.operator.logical.regexp.shell + # ^ punctuation.definition.group.end.regexp.shell + # ^ keyword.control.conditional.patterns.end.shell + update_terminal_cwd() { print -Pn "\e]2;%~\a" };; + # ^ meta.function punctuation.section.compound.end.shell + # ^^ punctuation.terminator.case.clause.shell + *) + # <- constant.other.wildcard.asterisk.shell + #^ keyword.control.conditional.patterns.end.shell + update_terminal_cwd() {};; + # ^ meta.function punctuation.section.compound.end.shell + # ^^ punctuation.terminator.case.clause.shell +esac +# <- keyword.control.conditional.end.shell -exec \ - -la name \ -#^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ meta.string.shell string.unquoted.shell -# ^^ punctuation.separator.continuation.line.shell +case $SERVER in +# <- keyword.control.conditional.case.shell +ws-+([0-9]).host.com) echo "Web Server" +#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell +# ^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^ keyword.operator.quantifier.regexp.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^ punctuation.definition.set.begin.regexp.shell +# ^^^ constant.other.range.regexp.shell +# ^ punctuation.separator.sequence.regexp.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ punctuation.definition.group.end.regexp.shell +# ^ keyword.control.conditional.patterns.end.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +db-+([0-9])\.host\.com) echo "DB server" +#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell +# ^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^ keyword.operator.quantifier.regexp.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^ punctuation.definition.set.begin.regexp.shell +# ^^^ constant.other.range.regexp.shell +# ^ punctuation.separator.sequence.regexp.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ punctuation.definition.group.end.regexp.shell +# ^ keyword.control.conditional.patterns.end.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +bk-+([0-9])\.host\.com) echo "Backup server" +# ^ keyword.operator.quantifier.regexp.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^ punctuation.definition.set.begin.regexp.shell +# ^^^ constant.other.range.regexp.shell +# ^ punctuation.separator.sequence.regexp.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ punctuation.definition.group.end.regexp.shell +# ^ keyword.control.conditional.patterns.end.shell +# ^^^^ support.function.echo.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +*)echo "Unknown server" +# <- constant.other.wildcard.asterisk.shell +#^ keyword.control.conditional.patterns.end.shell +# ^^^^ support.function.echo.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +esac +# <- keyword.control.conditional.end.shell +#^^^ keyword.control.conditional.end.shell -exec \ - -la name \ - "$cmd" \ -#^ meta.function-call.arguments.shell -# ^^^^^^ meta.function-call.identifier.shell meta.string.shell -# ^^^ meta.function-call.arguments.shell -# ^^ punctuation.separator.continuation.line.shell +case $_G_unquoted_arg in +*[\[\~\#\&\*\(\)\{\}\|\;\<\>\?\'\ ]*|*]*|"") +#^ punctuation.definition.set.begin.regexp.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ - keyword.control + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; +*) + _G_quoted_arg=$_G_unquoted_arg +;; +esac +case $1 in +*[\\\`\"\$]*) +#^ punctuation.definition.set.begin.regexp.shell +# ^^^^^^^^ constant.character.escape.shell +# ^ punctuation.definition.set.end.regexp.shell + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; +*) + _G_unquoted_arg=$1 ;; +esac -exec \ - -la name \ - "$cmd" \ - $opts \ -#^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ punctuation.separator.continuation.line.shell -exec \ - -la name \ - "$cmd" \ - $opts \ - --cmd-flag -#^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +############################################################################### +# 3.2.5 Compound Commands # +# 3.2.5.3 Grouping Commands # +# https://www.gnu.org/software/bash/manual/bash.html#Command-Grouping # +############################################################################### +(foo) -o +# <- meta.compound.shell punctuation.section.compound.begin.shell +#^^^ meta.compound.shell meta.function-call.identifier.shell variable.function.shell +# ^ meta.compound.shell punctuation.section.compound.end.shell +# ^^^ meta.compound.arguments.shell -#################################################################### -# export builtin # -#################################################################### +{ foo -o } --opt -- --no-option +# <- meta.compound.shell punctuation.section.compound.begin.shell +#^^^^^^^^^ meta.compound.shell - meta.compound meta.compound +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell - meta.compound meta.compound +# ^ - meta.compound +# ^^^ variable.function.shell +# ^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell +# ^ meta.parameter.option.shell variable.parameter.option.shell - punctuation +# ^ punctuation.section.compound.end.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell - punctuation +# ^^ keyword.operator.end-of-options.shell +# ^^^^^^^^^^^ - variable - punctuation -export -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^ - meta.function-call +{ +# <- meta.compound.shell punctuation.section.compound.begin.shell +#^ meta.compound.shell - meta.compound meta.compound + { +#^ meta.compound.shell - meta.compound meta.compound +# ^^ meta.compound.shell meta.compound.shell +# ^ punctuation.section.compound.begin.shell + foo args +#^^^^^^^^^^^^ meta.compound.shell meta.compound.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^^ meta.function-call.arguments.shell + } 2>> "$stderr_log" +#^^ meta.compound.shell meta.compound.shell +# ^^^^^^^^^^^^^^^^^^ meta.compound.shell meta.compound.arguments.shell +# ^ meta.compound.shell - meta.compound meta.compound +# ^ punctuation.section.compound.end.shell + # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function +} 1>> "$stdout_log" +# <- meta.compound.shell - meta.compound meta.compound +#^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell +# ^ - meta +# <- punctuation.section.compound.end.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function -export foo # 'foo' is a variable name -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ variable.other.readwrite.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -export foo bar # 'foo' and 'bar' are variable names -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ variable.other.readwrite.shell -# ^ - variable -# ^^^ variable.other.readwrite.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +############################################################################### +# 3.2.6 Coprocesses # +# https://www.gnu.org/software/bash/manual/bash.html#Coprocesses # +############################################################################### -export foo='bar' # 'foo' is a variable name -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ meta.string.shell string.quoted.single.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +coproc +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell keyword.declaration.coproc.shell +# ^ - meta.coproc - keyword -export PGPASSWORD=$(cat "$DOKKU_ROOT/.postgresql/pwd_$APP") -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string - meta.interpolation -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.shell meta.interpolation.command.shell -# ^^^^^^^^^^ meta.variable.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ punctuation.definition.variable.shell -# ^ punctuation.section.interpolation.begin.shell -# ^^^ variable.function.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell meta.string.shell +coproc na\ +me args +# <- meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call -export -f foo -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^ meta.function-call.arguments.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^ meta.variable.shell variable.function.shell +coproc name ar\ +gs +# <- meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call -export PATH="$PATH:$HOME/.local/bin" -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -# ^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string -# ^ string.quoted.double punctuation.definition.string.begin -# ^^^^^ meta.interpolation.parameter variable.other.readwrite -# ^ punctuation.definition.variable -# ^ string.quoted.double punctuation.separator.sequence -# ^^^^^ meta.interpolation.parameter variable.other.readwrite -# ^ punctuation.definition.variable -# ^^^^^^^^^^^^ string.quoted.double -# ^ punctuation.definition.string.end +coproc sed s/^/foo/ +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell - meta.function-call +# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call +#^^^^^ keyword.declaration.coproc.shell +# ^^^ variable.function.shell -export PATH="$PATH:~/.local/bin" -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^ string.quoted.double punctuation.definition.string.begin -# ^^^^^ meta.interpolation.parameter variable.other.readwrite -# ^ punctuation.definition.variable -# ^ string.quoted.double punctuation.separator.sequence -# ^ punctuation.definition.string.end +coproc ls thisfiledoesntexist; read; 2>&1 +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell +# ^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^^ meta.coproc.command.shell - meta.function-call.identifier.shell +# ^^^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^ meta.coproc.command.shell - meta.function-call.identifier.shell +# ^ - meta.coproc +#^^^^^ keyword.declaration.coproc.shell +# ^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ support.function.read.shell +# ^ punctuation.terminator.statement.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -export SOMETHING='/etc/test:/var/test:../foo:./foo' -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -# ^^^^^^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single -# ^ punctuation.definition.string.begin -# ^ punctuation.separator.sequence -# ^ punctuation.separator.sequence -# ^ punctuation.separator.sequence -# ^ punctuation.definition.string.end +coproc awk '{print "foo" $0;fflush()}' +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell +# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call +#^^^^^ keyword.declaration.coproc.shell +# ^^^ variable.function.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell string.quoted.single.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell -export SOMETHING=/etc/test:/var/test -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -# ^^^^^^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^^^^^^^^^^^^^^^^^^^ meta.string string.unquoted -# ^ punctuation.separator.sequence +coproc { ls thisfiledoesntexist; read; 2>&1 } | foo +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell +# ^^^^^^ meta.coproc.command.shell - meta.compound +# ^ - meta.function-call - meta.function.coproc +# ^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ - meta.function-call.identifier.shell +# ^^^^ meta.function-call.identifier.shell +# ^^^^^^^^ - meta.function-call.identifier.shell +#^^^^^ keyword.declaration.coproc.shell +# ^ punctuation.section.compound.begin.shell +# ^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ support.function.read.shell +# ^ punctuation.terminator.statement.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.section.compound.end.shell +# ^ keyword.operator.assignment.pipe.shell +# ^^^ variable.function.shell -msg="Count: ${count}" -# ^ meta.string string.quoted.double - punctuation.separator +coproc myls { ls thisfiledoesntexist; read; 2>&1 } | foo +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^^^^^^ meta.coproc.identifier.shell - meta.compound +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell +# ^^^ - meta.function-call +# ^^^ meta.function-call.identifier.shell +#^^^^^ keyword.declaration.coproc.shell +# ^ punctuation.section.compound.begin.shell +# ^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ support.function.read.shell +# ^ punctuation.terminator.statement.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.section.compound.end.shell +# ^ keyword.operator.assignment.pipe.shell +# ^^^ variable.function.shell -url="https://sublimetext.com/" -# ^ meta.string string.quoted.double - punctuation.separator +{ coproc tee { tee logfile ;} >&3 ;} 3>&1 +# <- meta.compound.shell punctuation.section.compound.begin.shell +# ^^^^^^ meta.compound.shell meta.coproc.shell +# ^^^^^ meta.compound.shell meta.coproc.identifier.shell +# ^^^^^^^^^^^^^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.shell +# ^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.arguments.shell +# ^^^ meta.compound.shell - meta.coproc +# ^^^^^ meta.compound.arguments.shell - meta.coproc - meta.function-call +# ^^^^^^ keyword.declaration.coproc.shell +# ^^^ entity.name.function.shell +# ^ punctuation.section.compound.begin.shell +# ^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.assignment.redirection +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.section.compound.end.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -#################################################################### -# local builtin # -#################################################################### +coproc foobar { +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^^^^^^^^ meta.coproc.identifier.shell +# ^^ meta.coproc.command.shell meta.compound.shell +#^^^^^ keyword.declaration.coproc.shell +# ^^^^^^ entity.name.function.shell +# ^ punctuation.section.compound.begin.shell + read +#^^^^^^^^ meta.coproc.command.shell meta.compound.shell +# ^^^^ meta.coproc.command.shell meta.compound.shell meta.function-call.identifier.shell support.function.read.shell +} +# <- meta.coproc.command.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta -local -#<- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^ - meta.declaration.variable -local; -#^^^^ keyword.declaration.variable.shell -local& -#^^^^ keyword.declaration.variable.shell -local| -#^^^^ keyword.declaration.variable.shell -local>/dev/null -#^^^^ keyword.declaration.variable.shell -local - -#^^^^ keyword.declaration.variable.shell -local() -#^^^^ keyword.declaration.variable.shell -local[] -#^^^^^^ - storage - keyword.declaration -local{} -#^^^^^^ - storage - keyword.declaration -local- -#^^^^^ - storage - keyword.declaration --local -#^^^^^ - storage - keyword.declaration -local+ -#^^^^^ - storage - keyword.declaration -local$ -#^^^^^ - storage - keyword.declaration -local$var -#^^^^^^^^ - storage - keyword.declaration -local= -#^^^^^ - storage - keyword.declaration -local-= -#^^^^^^ - storage - keyword.declaration -local+= -#^^^^^^ - storage - keyword.declaration -local foo bar # 'foo' and 'bar' are variable names -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +############################################################################### +# 3.3 Shell Functions # +# https://www.gnu.org/software/bash/manual/bash.html#Shell-Functions # +############################################################################### -local foo bar='baz' # 'foo' and 'bar' are variable names -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ meta.string.shell string.quoted.single.shell -# ^ - comment - string -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell + () +#^^ - meta.function +# ^ meta.function.parameters.shell +# ^ meta.function.parameters.shell +# ^ meta.function.shell -local foo+=10 bar-=true -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^^ keyword.operator.assignment.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^^ keyword.operator.assignment.shell -# ^^^^ constant.language.boolean.shell - -local pid="$(cat "$PIDFILE" 2>/dev/null)" -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell + () + {} +# ^ meta.function.shell - meta.compound +# ^^ meta.function.shell meta.compound.shell +# ^ - meta.function +# ^ punctuation.section.compound.begin.shell +# ^ punctuation.section.compound.end.shell -local -fn foo -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^ meta.variable.shell variable.function.shell + () \ + {} +# ^ meta.function.shell - meta.compound +# ^^ meta.function.shell meta.compound.shell +# ^ - meta.function +# ^ punctuation.section.compound.begin.shell +# ^ punctuation.section.compound.end.shell -f() { - local -a "$@" - # <- keyword.declaration.variable.shell - #^^^^ keyword.declaration.variable.shell - # ^^ meta.parameter.option.shell variable.parameter.option.shell - # ^^^^ meta.string.shell - local x - # <- keyword.declaration.variable.shell - #^^^^ keyword.declaration.variable.shell - # ^ meta.variable.shell variable.other.readwrite.shell + () { [[ $# == 2 ]] && tput setaf $2 || tput setaf 3; echo -e "$1"; tput setaf 15; } +#^^ source.shell - meta.function +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.shell - meta.function meta.function +# ^ meta.function.parameters.shell +# ^ meta.function.parameters.shell +# ^ meta.function.shell - meta.function.identifier - meta.compound +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.shell meta.compound.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ - punctuation +# ^ punctuation.section.compound.begin.shell +# ^^ support.function.test.begin +# ^ punctuation.definition.variable +# ^ variable.language +# ^^ keyword.operator.comparison +# ^^ support.function.test.end +# ^^ keyword.operator.logical - for x; do - case $x in - $1) - local "$x"'+=(1)' ;;& - # <- keyword.declaration.variable.shell - # ^^^ punctuation.terminator.case.clause.shell - $2) - local "$x"'+=(2)' ;& - # <- keyword.declaration.variable.shell - # ^^ punctuation.terminator.case.clause.shell - $3) - local "$x"'+=(3)' ;; - # <- keyword.declaration.variable.shell - # ^^ punctuation.terminator.case.clause.shell - $1|$2) - local "$x"'+=(4)' - # <- keyword.declaration.variable.shell - esac - # <- meta.function.shell meta.compound.shell meta.conditional.case.shell - # <- keyword.control.conditional.end.shell + logC () { [[ $# == 2 ]] && tput setaf $2 || tput setaf 3; echo -e "$1"; tput setaf 15; } +#^^ source.shell - meta.function +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.shell - meta.function meta.function +# ^^^^ meta.function.identifier.shell +# ^ meta.function.identifier.shell +# ^ meta.function.parameters.shell +# ^ meta.function.parameters.shell +# ^ meta.function.shell - meta.function.identifier - meta.compound +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.shell meta.compound.shell +#^^ - entity +# ^^^^ entity.name.function.shell +# ^ - entity - punctuation +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ - punctuation +# ^ punctuation.section.compound.begin.shell +# ^^ support.function.test.begin.shell +# ^ punctuation.definition.variable.shell +# ^^ variable.language.shell +# ^^ keyword.operator.comparison.shell +# ^^ support.function.test.end.shell +# ^^ keyword.operator.logical.shell - IFS=, local -a "$x"'=("${x}: ${'"$x"'[*]}")' - # ^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^ meta.string.shell string.unquoted.shell - # ^ keyword.declaration.variable.shell - done - # <- meta.function.shell meta.compound.shell - # <- keyword.control.loop.end.shell +logExit ( ) { +# <- source.shell meta.function.identifier.shell entity.name.function.shell +#^^^^^^^^^^^^^ source.shell - meta.function meta.function +#^^^^^^ meta.function.identifier.shell entity.name.function.shell +# ^ meta.function.identifier.shell +# ^^^ meta.function.parameters.shell +# ^ meta.function.shell - meta.compound +# ^^ meta.function.shell meta.compound.shell +#^^^^^^ entity.name.function.shell +# ^ - entity - punctuation +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ punctuation.section.compound.begin.shell + [[ $1 == '0' ]] && tput setaf 2 || tput setaf 1; + #<- meta.conditional.shell support.function.test.begin.shell + #^ meta.conditional.shell support.function.test.begin.shell + # ^^ meta.conditional.shell support.function.test.end.shell + [[ $1 == '0' ]] && echo -e "$2 PASSED" || echo -e "$2 FAILED"; + #<- meta.conditional.shell support.function.test.begin.shell + #^ meta.conditional.shell support.function.test.begin.shell + # ^^ meta.conditional.shell support.function.test.end.shell + # ^^ keyword.operator.logical.shell + # ^^^^ meta.function-call.identifier.shell support.function.echo.shell + tput setaf 15; + # <- meta.function meta.function-call variable.function + # ^ meta.function punctuation.terminator.statement + [[ $1 == '0' ]] || exit -1 + #<- meta.conditional.shell support.function.test.begin.shell + #^ meta.conditional.shell support.function.test.begin.shell + # ^^ meta.conditional.shell support.function.test.end.shell + # ^^ keyword.operator.logical.shell + # ^^^^ keyword.control.flow.exit.shell + # ^ keyword.operator.arithmetic.shell + # ^ meta.number.integer.decimal.shell constant.numeric.value.shell } # <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function +logExit $? $WEIRD +# <- meta.function-call.identifier.shell variable.function.shell +#^^^^^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.language.shell +# ^ - meta.interpolation - variable +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.function-call - meta.interpolation - variable -#################################################################### -# readonly builtin # -#################################################################### +function foo +#^^^^^^^^^^^^ source.shell - meta.function meta.function +# <- source.shell meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^ meta.function.identifier.shell +#^^^^^^^ keyword.declaration.function.shell +# ^ - entity - keyword - storage +# ^^^ entity.name.function.shell +# ^ - entity +{ +# <- meta.function.shell meta.compound.shell punctuation.section.compound.begin.shell + foo bar + # <- meta.function.shell meta.compound.shell meta.function-call.identifier.shell + # <- variable.function.shell -readonly foo # 'foo' is a variable name -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -#^^^^^^^ keyword.declaration.variable.shell -# ^ - storage - variable -# ^^^ variable.other.readwrite -# ^ - variable + return 0 + # <- keyword.control.flow.return.shell + #^^^^^ keyword.control.flow.return.shell + # ^ meta.number.integer.decimal.shell constant.numeric.value.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -readonly -f foo # 'foo' is a variable name -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^^ meta.declaration.variable.shell -# ^^^^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -#^^^^^^^ keyword.declaration.variable.shell -# ^ - storage - variable -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ meta.variable.shell variable.function.shell -# ^ - variable +# <- - meta.function -foo=`readonly x=5` -# <- variable.other.readwrite -# ^ meta.interpolation.command.shell punctuation.section.interpolation.begin.shell -# ^^^^^^^^ meta.interpolation.command.shell keyword.declaration.variable.shell -# ^ meta.interpolation.command.shell variable.other.readwrite -# ^ meta.interpolation.command.shell keyword.operator.assignment -# ^ meta.string.shell meta.interpolation.command.shell meta.declaration.variable.arguments.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ meta.interpolation.command.shell punctuation.section.interpolation.end.shell +function func\ +name +# <- source.shell meta.function.identifier.shell entity.name.function.shell +function foo ( ) { +#^^^^^^^^^^^^^^^^^^^^^^ source.shell - meta.function meta.function +# <- source.shell meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^ meta.function.identifier.shell +# ^^^^^^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^ - entity.name.function +# ^^^ entity.name.function.shell +# ^ - entity.name.function +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ punctuation.section.compound.begin.shell + echo 'hello from foo' + # <- meta.function.shell meta.compound.shell meta.function-call.identifier.shell + # <- support.function.echo.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -#################################################################### -# typeset builtin # -#################################################################### +# <- - meta.function -typeset foo # 'foo' is a variable name -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -#^^^^^^ keyword.declaration.variable.shell -# ^ - storage - variable -# ^^^ variable.other.readwrite -# ^ - variable -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +f () ( +# <- meta.function.identifier.shell entity.name.function.shell +#^ meta.function.identifier.shell - entity - punctuation +# ^^ meta.function.parameters.shell +# ^ meta.function.shell - meta.compound +# ^ meta.function.shell meta.compound.shell punctuation.section.compound.begin.shell + echo hello + # <- meta.function.shell meta.compound.shell meta.function-call.identifier.shell + # <- support.function.echo.shell +) +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -typeset -f _init_completion > /dev/null && complete -F _upto upto -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^ - meta.declaration - meta.function-call -# ^^^^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option.shell -# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell -# ^ keyword.operator.assignment.redirection.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^ variable.function.shell -# ^^ variable.parameter.option.shell - - -#################################################################### -# test builtin # -#################################################################### +function f ( +# <- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^ meta.function.identifier.shell +# ^^ meta.function.shell meta.compound.shell +#^^^^^^^ keyword.declaration.function.shell +# ^ entity.name.function.shell +# ^ punctuation.section.compound.begin.shell + echo hello + # <- meta.function meta.function-call support.function.echo +) +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -test -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^ - meta.function-call -test; -#^^^ support.function.test.shell -test& -#^^^ support.function.test.shell -test| -#^^^ support.function.test.shell -test>/dev/null -#^^^ support.function.test.shell -test - -#^^^ support.function.test.shell -test() -#^^^ support.function.test.shell -test[] -#^^^^^ - support.function -test{} -#^^^^^ - support.function -test- -#^^^^ - support.function --test -#^^^^ - support.function -test+ -#^^^^ - support.function -test$ -#^^^^ - support.function -test$var -#^^^^^^^ - support.function -test= -#^^^^ - support.function -test-= -#^^^^^ - support.function -test+= -#^^^^^ - support.function +function foo { +# <- meta.function.shell keyword.declaration.function.shell + function bar { + # <- meta.function meta.function + echo "baz" + } + bar + # <- meta.function meta.function-call -test $var != 0 -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp -# ^ - meta.function-call -# ^^ keyword.operator.comparison.shell -# ^ constant.numeric.value.shell + bar () { + # <- meta.function meta.function + echo "baz" + } + bar + # <- meta.function meta.function-call + function function + # <- meta.function meta.function + # ^ - entity.name.function + # ^^^^^^^^ entity.name.function + # ^ - entity.name.function + { + echo "Hello! From 'function'!" + } + "function" + # <- meta.function meta.function-call +} -test $var == true -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp -# ^^ keyword.operator.comparison.shell -# ^^^^ constant.language.boolean.shell +# <- - meta.function -test str == "str" -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ string.quoted.double.shell +foo=$( + # ^ punctuation.section.interpolation.begin.shell + func() { + # <- meta.function entity.name.function + # ^ punctuation.section + echo bar + } + # <- punctuation.section + func -test var[0] != var[^0-9]*$ -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp + # <- meta.interpolation.command +) +# <- punctuation.section.interpolation.end.shell +echo $foo # prints "bar" -test ${var[0]} != var[^0-9]*$ -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^ meta.interpolation.parameter.shell -# ^^^ variable.other.readwrite.shell -# ^^^ meta.item-access.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp +# <- - meta.function - meta.interpolation -test expr -a expr -o expr -- | cmd |& cmd -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ - keyword -# ^ keyword.operator.assignment.pipe.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.assignment.pipe.shell +foo:foo () { + # <- meta.function entity.name.function + echo "this foo:foo" +} +~ () { +# <- meta.function entity.name.function + echo "this is ~" +} +"~" +# <- meta.function-call.identifier.shell meta.string.shell variable.function.shell punctuation.definition.string.begin.shell +#^^ meta.function-call.identifier.shell meta.string.shell variable.function.shell +^ () { +# <- meta.function entity.name.function + echo "this is ^" +} +^ +# <- meta.function-call.identifier.shell variable.function.shell +@ () { +# <- meta.function entity.name.function + echo "this is @" +} +@ +# <- meta.function-call.identifier.shell variable.function.shell -test ! $line == ^[0-9]+$ -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell - meta.function-call.arguments -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier -# ^ - meta.function-call -#^^^ support.function.test.shell -# ^ keyword.operator.logical.shell -# ^^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^^^^ meta.string.shell string.unquoted.shell +function () () +# <- meta.function.identifier.shell entity.name.function.shell +function () {} +# <- meta.function.identifier.shell entity.name.function.shell -test ! $line =~ ^[0-9]+$ >> /file -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell - meta.function-call.arguments -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier - meta.group -# ^ - meta.function-call -#^^^ support.function.test.shell -# ^ keyword.operator.logical.shell -# ^^^^^ variable.other.readwrite.shell -# ^^ invalid.illegal.operator.shell -# ^^^^^^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.assignment.redirection.shell +function 7zip { +# <- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell keyword.declaration.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^^^ entity.name.function.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +7zip +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -if test expr -a expr ; then echo "success"; fi -# ^ - meta.function-call -# ^^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^^^^ support.function.echo.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +function [] () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from []" +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +[] +# <- meta.function-call.identifier.shell variable.function.shell +#^ meta.function-call.identifier.shell variable.function.shell -if test "$VAR" != ";";then;fi -# ^ - meta.function-call -# ^^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^ meta.string.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.quoted.double.shell -# ^^^^^^^^ - meta.function-call -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +function [[]] () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from [[]]" +} +[[]] +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -let test -z $2 && { } -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^ - meta.function-call - meta.compound -# ^^^ meta.compound.shell - meta.function-call -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^ punctuation.section.compound.end.shell - -let $var == test -z $5 && cmd -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^ - meta.function-call -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.logical.shell -# ^^^ variable.function.shell - -let 'test -z $2 && { }' -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^ - meta.compound -# ^ - meta.function-call -# ^ string.quoted.single.shell punctuation.definition.string.begin.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.logical.shell -# ^ string.quoted.single.shell punctuation.definition.string.end.shell +function {} () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from {}" +} +{} +# <- meta.function-call.identifier.shell variable.function.shell +#^ meta.function-call.identifier.shell variable.function.shell -let '$var == test -z \'$5\' && cmd' -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^ string.quoted.single.shell punctuation.definition.string.begin.shell -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ constant.character.escape.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ constant.character.escape.shell -# ^^ keyword.operator.logical.shell -# ^^^ - variable.function -# ^ string.quoted.single.shell punctuation.definition.string.end.shell +function {{}} () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from {{}}" +} +{{}} +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -let "$var != test -z '$5' && cmd" -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^ string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ string.quoted.single.shell -# ^^ keyword.operator.logical.shell -# ^^^ - variable.function -# ^ string.quoted.double.shell punctuation.definition.string.end.shell +function -foo () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from -foo" +} +-foo +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell +function +foo () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from +foo" +} ++foo +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -#################################################################### -# unalias builtin # -#################################################################### +function =foo () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from =foo" +} +=foo +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -unalias -unalias -a -b -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function -# ^^ variable.parameter.option.shell -# ^^ invalid.illegal.parameter.shell +function fo${bar}'baz' () {} +# ^^^ meta.function.identifier.shell - meta.interpolation - meta.string +# ^^^^^^ meta.function.identifier.shell meta.interpolation.parameter.shell - meta.string +# ^^^^^ meta.function.identifier.shell meta.string.shell - meta.interpolation +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^^ entity.name.function.shell +# ^^^^^^ - entity.name +# ^^^^^ entity.name.function.shell -unalias foo -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable +# Functions may replace booleans. Won't respect that in function calls though. +function true () {} ; function false () {} +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^^ - meta.function +# ^^^^^^^^ meta.function.shell +# ^^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^^^^ entity.name.function.shell +# ^^^^^ entity.name.function.shell +# ^ punctuation.terminator.statement.shell -unalias foo # comment -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^ - meta.function -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^^^^^^^^ comment.line.number-sign.shell +__git_aliased_command () +{ + local word cmdline=$(__git config --get "alias.$1") + for word in $cmdline; do + case "$word" in + {) : skip start of shell helper function ;; +# ^ - punctuation.section.interpolation.begin +# ^ keyword.control.conditional.patterns.end.shell + \'*) : skip opening quote after sh -c ;; + *) + echo "$word" + return + esac + done +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -unalias foo b"a"r b'a'z 7za -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable +# <- - meta.function -#################################################################### -# unset builtin # -#################################################################### - -unset -unset foo b'a'r ba${z} # 'foo' and 'bar' are variable names -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^ meta.variable.shell - meta.string -# ^^^ meta.variable.shell meta.string.shell -# ^ meta.variable.shell - meta.string -#^^^^ support.function.unset.shell -# ^ - meta.variable - support - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - meta.variable - variable -# ^^^^^ variable.other.readwrite.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell -# ^ - meta.variable - variable -# ^^ meta.variable.shell - meta.interpolation -# ^^^^ meta.variable.shell meta.interpolation.parameter.shell -# ^ - meta.variable - variable -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell - -unset -n -unset -nfv foo -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^^^ support.function.unset.shell -# ^^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ variable.function.shell -# ^ - variable - -unset -f -n -v foo b'a'r; unset -vn foo 2>& /dev/null -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ - meta.function-call -# ^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^ - meta.string -# ^^^ meta.string.shell -# ^ - meta.string -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ variable.function.shell -# ^ - variable -# ^^^^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^^ support.function.unset.shell -# ^ - support - variable -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell - -unset -f -x +v -- foo bar; unset -vn -- foo -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ - meta.function-call -# ^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ invalid.illegal.parameter.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ - variable -# ^^ keyword.operator.end-of-options.shell -# ^^^ variable.function.shell -# ^ - variable -# ^^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^^ support.function.unset.shell -# ^ - support - variable -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ - variable -# ^^ keyword.operator.end-of-options.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable - -unset- -# <- - support.function -unset+ -# <- - support.function -unset() -# <- support.function.unset.shell -unset[] -# <- - support.function -unset{} -# <- - support.function -unset= -# <- - support.function -unset+= -# <- - support.function -unset-= -# <- - support.function - - -#################################################################### -# Linux builtins # -#################################################################### - -sudo rm -rf -# <- meta.function-call.identifier.shell support.function.sudo.shell -#^^^ meta.function-call.identifier.shell support.function.sudo.shell -# ^^ meta.function-call.identifier.shell variable.function.shell -# ^^^^ meta.function-call.arguments.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell - -sudo -b -g network --host=$foo rm -rf -# <- meta.function-call.identifier.shell support.function.sudo.shell -#^^^ meta.function-call.identifier.shell support.function.sudo.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell -# ^^^^^^^ meta.string.shell string.unquoted.shell -# ^^^^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ punctuation.definition.parameter.shell -# ^ keyword.operator.assignment.shell -# ^^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ variable.function.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell - -sudo --reset-timestamp -n -f -- rm -rf -# <- meta.function-call.identifier.shell support.function.sudo.shell -#^^^ meta.function-call.identifier.shell support.function.sudo.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^^^^^^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ invalid.illegal.parameter.shell -# ^^ keyword.operator.end-of-options.shell -# ^^ variable.function.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell - - -#################################################################### -# Variable assignments # -#################################################################### +############################################################################### +# 3.4 Shell Parameters # +# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameters # +############################################################################### x= # some comment #^ keyword.operator.assignment.shell @@ -2928,29 +3034,42 @@ commits=($(git rev-list --reverse --$abbrev-commit "$latest".. -- "$prefix")) # <- - variable.other.readwrite -#################################################################### -# Variables # -#################################################################### +############################################################################### +# 3.4.1 Positional Parameters # +# https://www.gnu.org/software/bash/manual/bash.html#Positional-Parameters # +############################################################################### -: $__ -# ^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable +: $1 $2 $3 $45 $678 +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^^ - meta.interpolation - variable -: $var_0 -# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# When a positional parameter consisting of more than a single digit is expanded, +# it must be enclosed in braces. +: ${45} ${678} +# ^^^^^ meta.interpolation.parameter.shell # ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable +# ^ punctuation.section.interpolation.begin.shell +# ^^ variable.other.readwrite.shell +# ^ punctuation.section.interpolation.end.shell +# ^^^^^^ meta.interpolation.parameter.shell +# ^ punctuation.definition.variable.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^ variable.other.readwrite.shell +# ^ punctuation.section.interpolation.end.shell -: $_var0 -# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable -: $_0var_ -# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable +############################################################################### +# 3.4.2 Special Parameters # +# https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters # +############################################################################### # Expands to the positional parameters, starting from one. When the expansion is # not within double quotes, each positional parameter expands to a separate @@ -3024,40 +3143,31 @@ commits=($(git rev-list --reverse --$abbrev-commit "$latest".. -- "$prefix")) # ^^ meta.interpolation.parameter.shell variable.language.shell # ^ punctuation.definition.variable.shell -fg % -# ^ meta.interpolation.job.shell variable.other.readwrite.shell punctuation.definition.variable.shell -fg %% -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %+ -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %- -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %1 %2 %3 -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %ce -# ^^^ meta.interpolation.job.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -fg %?ce -# ^^^^ meta.interpolation.job.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ keyword.operator.match.shell -%1 -# <- meta.interpolation.job.shell variable.language.job.shell punctuation.definition.variable.shell -#^ meta.interpolation.job.shell variable.language.job.shell +############################################################################### +# 3.5.3 Shell Parameter Expansion # +# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion# +############################################################################### + +: $__ +# ^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable + +: $var_0 +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable +: $_var0 +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable -#################################################################### -# Strings and interpolation in parameter expansion # -#################################################################### +: $_0var_ +# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable ${foo:=bar} # <- meta.function-call.identifier.shell meta.interpolation.parameter.shell punctuation.definition.variable.shell @@ -3436,9 +3546,9 @@ ${foo:=bar} # ^ - keyword -#################################################################### +############################################################################### # Braces in parameter expansion # -#################################################################### +############################################################################### : ${foo//foo\}foo\/foo/foo} # ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interpolation.parameter.shell @@ -3560,10 +3670,10 @@ ${var%%%Pattern} # ^ comment.line punctuation -#################################################################### -# Parameter-expansion operators # -# cf. http://www.tldp.org/LDP/abs/html/parameter-substitution.html # -#################################################################### +############################################################################### +# Parameter-expansion operators # +# cf. http://www.tldp.org/LDP/abs/html/parameter-substitution.html # +############################################################################### ${foo//%/} # <- meta.function-call.identifier.shell meta.interpolation.parameter.shell punctuation.definition.variable.shell @@ -3852,9 +3962,10 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^^ punctuation.section.interpolation.end.shell -#################################################################### -# [3.5.8.1] Pattern Matching # -#################################################################### +############################################################################### +# 3.5.8.1 Pattern Matching # +# https://www.gnu.org/software/bash/manual/bash.html#Pattern-Matching # +############################################################################### : @([^:]*) #^^^^^^^^^ meta.function-call.arguments.shell @@ -4058,9 +4169,12 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^ - keyword.control # ^ punctuation.section.interpolation.end.shell -#################################################################### -# Bash pattern matching in test expressions # -#################################################################### + +############################################################################### +# 3.5.8.1 Pattern Matching # +# https://www.gnu.org/software/bash/manual/bash.html#Pattern-Matching # +# in test expressions # +############################################################################### [[ abc == ?[a-z]? ]] # evaluates to true # ^ meta.string.regexp.shell - meta.set @@ -4205,45 +4319,12 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^ punctuation.definition.group.end.regexp.shell # ^^ support.function.test.end.shell -[[ $foo == 'bar' || $foo == "baz" && $bar == baz ]] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.regexp.shell -# ^^ support.function.test.end.shell - -[[ ( $foo == 'bar' || $foo == "baz" ) && $bar == baz ]] -# <- meta.conditional.shell support.function.test.begin.shell -#^^ meta.conditional.shell - meta.group -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell meta.group.shell -# ^^^^^^^^^^^^^^^^^^ meta.conditional.shell - meta.group -# ^ punctuation.section.group.begin.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^ punctuation.section.group.end.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.regexp.shell -# ^^ support.function.test.end.shell -#################################################################### -# POSIX extended regular expression pattern matching # -#################################################################### +############################################################################### +# POSIX extended regular expression pattern matching # +# https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions +# in test expressions # +############################################################################### [[ a =~ [ ]] #^^^^^^^^^^^ meta.conditional.shell @@ -4851,16 +4932,6 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^ punctuation.definition.literal.end.shell # ^ keyword.control.anchor.regexp.shell -[[ '-e' == -e ]] # -e undergoes pattern matching on the right -# ^^^^ meta.string.shell string.quoted.single.shell -# ^^ keyword.operator.comparison.shell -# ^^ meta.conditional.shell meta.string.regexp.shell - variable - -[[ -e == -e ]] # a syntax error in bash but allowed in zsh -# ^^ - variable.parameter.option -# ^^ keyword.operator.comparison.shell -# ^^ meta.conditional.shell meta.string.regexp.shell - variable - echo '([^.[:space:]]+) Class::method()' # colon not scoped as path separator # ^^^^^^^^^^^^^^^^^^^^^ string.quoted.single - punctuation.separator.sequence @@ -4900,1900 +4971,1934 @@ echo '([^.[:space:]]+) Class::method()' # colon not scoped as path separator # ^^^ meta.string.regexp.shell # ^^ support.function.test.end.shell -#################################################################### -# 6.4 Bash Conditional Expressions # -#################################################################### -[ ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^ meta.conditional.shell -# ^ support.function.test.end.shell +############################################################################### +# 3.6 Redirections # +# https://www.gnu.org/software/bash/manual/bash.html#Redirections # +############################################################################### -[ -a file ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^ meta.conditional.shell - -[ -v varname ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^ meta.conditional.shell +function show_help() { + echo "Usage: imgcat [-p] filename ..." 1>& 2 + # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell + echo " or: cat filename | imgcat" 1>& 2 + # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +} -[ file1 -ef file2 ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +foo 2>&1 +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +foo 2>&- +# ^ punctuation.terminator +foo | bar 2>&1 +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +foo | bar --opt1 arg1 < file.txt +# ^ meta.function-call.arguments keyword.operator.assignment.redirection +foo | bar --opt1 arg1 > file.txt +# ^ meta.function-call.arguments keyword.operator.assignment.redirection +foo -x arg1 &>/dev/null +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +foo -x arg1 &> /dev/null +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +tr "o" "a" < <(echo "Foo") +# ^ keyword.operator.assignment.redirection - keyword.operator.assignment.redirection.process +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ support.function +# ^ punctuation +wc <(cat /usr/share/dict/linux.words) +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ variable.function +# ^ meta.function-call.arguments meta.function-call.arguments +# ^ meta.function-call.arguments meta.function-call.arguments +# ^ punctuation +comm <(ls -l) <(ls -al) +# ^^^^^^^ meta.compound.shell +# ^^ - meta.compound +# ^^^^^^^^ meta.compound.shell +# ^ - meta.compound +# ^ keyword.operator.assignment.redirection.process.shell +# ^ punctuation.section.compound.begin.shell +# ^^ variable.parameter +# ^ punctuation.section.compound.end.shell +# ^ keyword.operator.assignment.redirection.process.shell +# ^ punctuation.section.compound.begin.shell +# ^ variable.function +# ^^^ variable.parameter +# ^ punctuation.section.compound.end.shell +gzip | tee >(md5sum - | sed 's/-$/mydata.lz2/'>mydata-gz.md5) > mydata.gz +# ^ keyword.operator.assignment.pipe.shell +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ keyword.operator.assignment.pipe.shell +# ^ keyword.operator.assignment.redirection +# ^ punctuation +# ^ keyword.operator.assignment.redirection +LC_ALL=C 2> /dev/null +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ keyword.operator.assignment.redirection +# ^ - variable.function +2>&1 echo foo +# <- meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +#^^ keyword.operator.assignment.redirection +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^^^ meta.function-call support.function.echo +# ^^^^ meta.function-call.arguments +touch file.txt +foo=x &${tee[1]} 2>&1 +# ^^^ meta.function-call.arguments.shell - meta.interpolation +# ^^^^^^^^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell +# ^^^^^ meta.function-call.arguments.shell - meta.interpolation +# ^^ keyword.operator.assignment.redirection +# ^ punctuation.definition.variable.shell +# ^ punctuation.section.interpolation.begin.shell -[ file1 -ot file2 ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell -[ ! str != str ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^ meta.conditional.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +############################################################################### +# 3.6.6 Here Documents # +# https://www.gnu.org/software/bash/manual/bash.html#Here-Documents # +############################################################################### -[ str != str ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^ meta.conditional.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +var=world! +cat < foo.txt +#^^^^^^ - meta.string - meta.tag +# ^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^^^^^^^^^^^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^ keyword.operator.assignment.redirection.shell +# ^ - entiy - keyword +# ^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell +# ^ - entiy - keyword +# ^ keyword.operator.assignment.redirection.shell +# ^^^^^^^ - variable.function +hello +# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell +redirection_comes_next +#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +#^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -[ str > str ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^ meta.conditional.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +cat << FARAWAY +#^^^^^^^^^^ - meta.string - meta.tag +# ^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^ keyword.operator.assignment.redirection.shell +# ^^^^^ - entiy - keyword +# ^^^^^^^ entity.name.tag.heredoc.shell +# ^ - entity +foo +# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell +FARAWAY +#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +#^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -[ $arg -lt 2 ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^ variable.other.readwrite.shell -# ^^^ keyword.operator.comparison.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ support.function.test.end.shell +cat <<- INDENTED +#^^^^^^^ - meta.string - meta.tag +# ^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^^ keyword.operator.assignment.redirection.shell +# ^ - entity - keyword +# ^^^^^^^^ entity.name.tag.heredoc.shell +# ^ - entity + say what now ${foo} +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation +# ^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.interpolation.parameter.shell - string + INDENTED +# <- meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag +#^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -#################################################################### -# Bash Numeric Constants # -#################################################################### +cat <<- 'indented_without_expansions' +#^^^^^^^^ - meta.string - meta.tag +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^^ keyword.operator.assignment.redirection.shell +# ^ punctuation.definition.tag.begin.shell - entity +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell +# ^ punctuation.definition.tag.end.shell - entity + ${foo} +#^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation +# ^^^ - variable.other + indented_without_expansions +#^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -true false -# <- constant.language.boolean.shell -#^^^ constant.language.boolean.shell -# ^ - constant -# ^^^^^ constant.language.boolean.shell -# ^ - constant +variable=$(cat <$dummy.c +#^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - string.unquoted.heredoc +# ^^^^^^^^^^^ meta.string.shell string.quoted.single.shell +# ^^^^ - meta.string +# ^^^ meta.string.heredoc.shell meta.tag.heredoc.shell +# ^^^^^^^^^^ meta.string.heredoc.shell - meta.tag +# ^^ keyword.operator.assignment.redirection.shell +# ^^^ entity.name.tag.heredoc.shell +# ^ keyword.operator.assignment.redirection.shell +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF +# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +#^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -(( 0xDEADBEEF 0xdeadbeef 0x1234567890abcdefg )) -# ^ - meta.number - constant -# ^^ meta.number.integer.hexadecimal.shell constant.numeric.base.shell -# ^^^^^^^^ meta.number.integer.hexadecimal.shell constant.numeric.value.shell -# ^ - meta.number - constant -# ^^ meta.number.integer.hexadecimal.shell constant.numeric.base.shell -# ^^^^^^^^ meta.number.integer.hexadecimal.shell constant.numeric.value.shell -# ^ - meta.number - constant -# ^^ meta.number.integer.hexadecimal.shell constant.numeric.base.shell -# ^^^^^^^^^^^^^^^^ meta.number.integer.hexadecimal.shell constant.numeric.value.shell -# ^^^^ - meta.number - constant -(( 64#123@_ )) -# ^^^ meta.number.integer.other.shell constant.numeric.base.shell -# ^^^^^ meta.number.integer.other.shell constant.numeric.value.shell +############################################################################### +# 4.2 Bash Builtin Commands (alias) # +# https://www.gnu.org/software/bash/manual/bash.html#index-alias # +# https://www.gnu.org/software/bash/manual/bash.html#Aliases # +############################################################################### +alias +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^ - meta.declaration.alias - storage -#################################################################### -# Arithmetic tests # -#################################################################### +alias foo=bar +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( a=b, a*=b, a/=b, a%=b, a+=b, a-=b, a<<=b, a>>=b, a&=b, a^=b, a|=b )) -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ variable.other.readwrite.shell -# ^ meta.arithmetic punctuation.separator -# ^ variable.other.readwrite.shell -# ^^ keyword.operator.assignment.augmented.shell -# ^ variable.other.readwrite.shell -# ^ meta.arithmetic punctuation.separator -# ^^ keyword.operator.assignment.augmented.shell -# ^ meta.arithmetic -# ^^ keyword.operator.assignment.augmented.shell -# ^ meta.arithmetic -# ^^ keyword.operator.assignment.augmented.shell -# ^ meta.arithmetic punctuation.separator -# ^^ keyword.operator.assignment.augmented.shell -# ^^^ keyword.operator.assignment.augmented.shell -# ^^^ keyword.operator.assignment.augmented.shell -# ^^ keyword.operator.assignment.augmented.shell -# ^^ keyword.operator.assignment.augmented.shell -# ^^ keyword.operator.assignment.augmented.shell -(( a++ a ++ )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell -(( a-- a -- )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell -(( ++a ++ a )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell -(( --a -- a )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell - -(( a/b a / b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a%b a % b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a+b a + b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a-b a - b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a*b a * b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a**16 a ** 16 )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell +alias f'o'o=bar +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^^^^ meta.variable.shell entity.name.function.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( ~1 )) -# ^ keyword.operator.bitwise.shell -(( a&b a & b)) -# ^ keyword.operator.bitwise.shell -# ^ keyword.operator.bitwise.shell -(( a^b a ^ b)) -# ^ keyword.operator.bitwise.shell -# ^ keyword.operator.bitwise.shell -(( a|b a | b)) -# ^ keyword.operator.bitwise.shell -# ^ keyword.operator.bitwise.shell -(( a<<12 a << 16 )) -# ^^ keyword.operator.bitwise.shell -# ^^ keyword.operator.bitwise.shell -(( a>>14 a >> 14 )) -# ^^ keyword.operator.bitwise.shell -# ^^ keyword.operator.bitwise.shell +alias -p foo=bar 7za=qux +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( a<=b a <= b )) -# ^^ keyword.operator.comparison.shell -# ^^ keyword.operator.comparison.shell -(( a>=b a >= b )) -# ^^ keyword.operator.comparison.shell -# ^^ keyword.operator.comparison.shell -(( ab a > b )) -# ^ keyword.operator.comparison.shell -# ^ keyword.operator.comparison.shell +alias -a -p -- foo=bar baz=qux +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^ invalid.illegal.parameter.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ keyword.operator.end-of-options.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( !1 ! 1 )) -# ^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -(( a&&b a && b )) -# ^^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -(( a||b a || b )) -# ^^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell +alias $foo=bar +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( a ? 0 : 1 )) -# ^ keyword.operator.ternary.shell -# ^ keyword.operator.ternary.shell -(((a>b) ? (a>c?a:c) : (b>c?b:c))) -# <- meta.arithmetic.shell punctuation.section.arithmetic.begin.shell - meta.group -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell -# ^^^^^ meta.group.shell -# ^^^ - meta.group.shell -# ^^^^^^^^^ meta.group.shell -# ^^^ - meta.group.shell -# ^^^^^^^^^ meta.group.shell -# ^^ - meta.group.shell -#^ punctuation.section.arithmetic.begin.shell -# ^ punctuation.section.group.begin.shell -# ^ keyword.operator.comparison.shell -# ^ punctuation.section.group.end.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.begin.shell -# ^ keyword.operator.comparison.shell -# ^ keyword.operator.ternary.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.end.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.begin.shell -# ^ keyword.operator.comparison.shell -# ^ keyword.operator.ternary.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.end.shell -# ^^ punctuation.section.arithmetic.end.shell +alias ..='cd ..' +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^ meta.string.shell string.quoted.single.shell -((a+=b)) -# ^ - string.unquoted +alias -p ..='cd ..' +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^ meta.string.shell string.quoted.single.shell -let 5 \ - + 5 -#^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^ keyword.operator.arithmetic.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell +alias -- -='cd -' +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^^ keyword.operator.end-of-options.shell +# ^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^ meta.string.shell string.quoted.single.shell -let 5+5 # comment -#^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^ support.function.let.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -let var[10]=5*(20+$idx) -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^ meta.item-access.shell -# ^ punctuation.section.item-access.begin.shell -# ^^ meta.string.shell string.unquoted.shell -# ^ punctuation.section.item-access.end.shell -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^ punctuation.section.group.begin.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^^^^ variable.other.readwrite.shell -# ^ punctuation.section.group.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (declare) # +# https://www.gnu.org/software/bash/manual/bash.html#index-declare # +############################################################################### -let "two=5+5"; if [[ "$X" == "1" ]]; then X="one"; fi -#^^ meta.function-call.identifier.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^ support.function.let.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^ meta.string.shell meta.interpolation.shell - string -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.if.shell -# ^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ string.quoted.double.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +declare # comment +#<- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^ - meta.declaration.variable +# ^^^^^^^^^^ comment.line.number-sign.shell +declare foo # 'foo' is a variable name +#^^^^^^ meta.declaration.variable.shell +# ^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +# <- keyword.declaration.variable.shell +# ^ - variable.other.readwrite +# ^ - meta.declaration.variable -#################################################################### -# Command chaining operators | and, or, pipe, redirection # -#################################################################### +declare +A # this is a comment +#^^^^^^ meta.declaration.variable.shell +# ^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +# ^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -function show_help() { - echo "Usage: imgcat [-p] filename ..." 1>& 2 - # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - echo " or: cat filename | imgcat" 1>& 2 - # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -} -cmd1 --opt1 arg1 | cmd2 --opt2 arg2 | cmd3 --opt3 arg3 -# ^ meta.function-call.identifier.shell variable.function.shell -# ^ variable.parameter - variable.function -# ^ - variable -# ^ keyword - # ^ meta.function-call.identifier.shell variable.function.shell - # ^ variable.parameter - variable.function - # ^ - variable - # ^ keyword - # ^ meta.function-call.identifier.shell variable.function.shell - # ^ variable.parameter - variable.function - # ^ - variable -C2=c2 C3=c3 C4=c4 -c1 -c1 c1 && ${C2} -c2 c2 || c3 -c3 ${C3} ; c4 -${C4} c4 | c5 -c5 c5 -#^ meta.function-call.identifier.shell variable.function.shell -# ^ variable.parameter - variable.function -# ^ - variable -# ^ keyword - # ^ meta.function-call.identifier.shell meta.interpolation.parameter.shell - # ^ variable.parameter - variable.function - # ^ - variable - # ^ keyword - # ^ meta.function-call.identifier.shell variable.function.shell - # ^ variable.parameter - variable.function - # ^ - variable.parameter - # ^ punctuation.terminator.statement.shell - # ^^ variable.function - # ^ variable.parameter +declare -A foo bar # 'foo' and 'bar' are variable names +#^^^^^^ meta.declaration.variable.shell +# ^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -foo 2>&1 -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -foo 2>&- -# ^ punctuation.terminator -foo | bar 2>&1 -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -foo | bar --opt1 arg1 < file.txt -# ^ meta.function-call.arguments keyword.operator.assignment.redirection -foo | bar --opt1 arg1 > file.txt -# ^ meta.function-call.arguments keyword.operator.assignment.redirection -foo -x arg1 &>/dev/null -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -foo -x arg1 &> /dev/null -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -tr "o" "a" < <(echo "Foo") -# ^ keyword.operator.assignment.redirection - keyword.operator.assignment.redirection.process -# ^ keyword.operator.assignment.redirection.process -# ^ punctuation -# ^ support.function -# ^ punctuation -wc <(cat /usr/share/dict/linux.words) -# ^ keyword.operator.assignment.redirection.process -# ^ punctuation -# ^ variable.function -# ^ meta.function-call.arguments meta.function-call.arguments -# ^ meta.function-call.arguments meta.function-call.arguments -# ^ punctuation -comm <(ls -l) <(ls -al) -# ^^^^^^^ meta.compound.shell -# ^^ - meta.compound -# ^^^^^^^^ meta.compound.shell -# ^ - meta.compound -# ^ keyword.operator.assignment.redirection.process.shell -# ^ punctuation.section.compound.begin.shell -# ^^ variable.parameter -# ^ punctuation.section.compound.end.shell -# ^ keyword.operator.assignment.redirection.process.shell -# ^ punctuation.section.compound.begin.shell -# ^ variable.function -# ^^^ variable.parameter -# ^ punctuation.section.compound.end.shell -gzip | tee >(md5sum - | sed 's/-$/mydata.lz2/'>mydata-gz.md5) > mydata.gz -# ^ keyword.operator.assignment.pipe.shell -# ^ keyword.operator.assignment.redirection.process -# ^ punctuation -# ^ keyword.operator.assignment.pipe.shell -# ^ keyword.operator.assignment.redirection -# ^ punctuation -# ^ keyword.operator.assignment.redirection -LC_ALL=C 2> /dev/null -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.assignment.redirection -# ^ - variable.function -2>&1 echo foo -# <- meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -#^^ keyword.operator.assignment.redirection -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^^^ meta.function-call support.function.echo -# ^^^^ meta.function-call.arguments -touch file.txt -foo=x /dev/null && complete -F _upto upto +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^ - meta.declaration - meta.function-call +# ^^^^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option.shell +# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell +# ^ keyword.operator.assignment.redirection.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^ variable.function.shell +# ^^ variable.parameter.option.shell + +printFunction "$variableString1" "$(declare -p variableArray)" +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option +# ^^^^^^^^^^^^^ variable.other.readwrite +# ^ punctuation.section.interpolation.end.shell + +# <- - variable.other +printFunction "$variableString1" "`declare -p variableArray`" +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option +# ^^^^^^^^^^^^^ variable.other.readwrite +# ^ punctuation.section.interpolation.end.shell + + +############################################################################### +# 4.2 Bash Builtin Commands (exec) # +# https://www.gnu.org/software/bash/manual/bash.html#index-exec # +############################################################################### + +exec +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell support.function.exec.shell + +exec -- +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +#^^^ support.function.exec.shell +# ^^^ meta.function-call.arguments.shell +# ^^ keyword.operator.end-of-options.shell + +exec 3<&- +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^^^^^ meta.function-call.arguments.shell +#^^^ support.function.exec.shell +# ^ constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ punctuation.terminator.file-descriptor.shell + +exec -- foo bar +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^^^ meta.function-call.arguments.shell +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +#^^^ support.function.exec.shell +# ^^ keyword.operator.end-of-options.shell +# ^^^ variable.function.shell + +exec -c -l -a name git status +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ meta.function-call.identifier.shell +# ^^^^^^^ meta.function-call.arguments.shell +# <- support.function.exec.shell +#^^^ support.function.exec.shell +# ^^ variable.parameter.option.shell +# ^^ variable.parameter.option.shell +# ^^ variable.parameter.option.shell +# ^^^^ meta.string.shell string.unquoted.shell +# ^^^ variable.function.shell + +exec -la name -i --bar -- foo bar +#^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +#^^^ support.function.exec.shell +# ^^^ variable.parameter.option.shell +# ^^^^ string.unquoted.shell +# ^^ invalid.illegal.parameter.shell +# ^^^^^ invalid.illegal.parameter.shell +# ^^ keyword.operator.end-of-options.shell +# ^^^ variable.function.shell + +exec -al name +#^^^ meta.function-call.identifier.shell +# ^^^^^ meta.function-call.arguments.shell +# ^^^^ meta.function-call.identifier.shell +#^^^ support.function.exec.shell +# ^^^ invalid.illegal.parameter.shell +# ^^^^ variable.function.shell + +exec git diff-index --check --cached $against -- +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^ meta.function-call.arguments.shell +# ^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# <- support.function.exec.shell +#^^^ support.function.exec.shell +# ^^^ variable.function.shell +# ^^^^^^^ variable.parameter.option.shell +# ^^^^^^^^ variable.parameter.option.shell +# ^^ keyword.operator.end-of-options.shell + +exec "$cmd" \ +#^^^ meta.function-call.identifier.shell +# ^ meta.function-call.arguments.shell +# ^^^^^^ meta.function-call.identifier.shell meta.string.shell +# ^^^ meta.function-call.arguments.shell +# ^^ punctuation.separator.continuation.line.shell + +exec "$cmd" \ + $opts \ +#^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ punctuation.separator.continuation.line.shell + +exec "$cmd" \ + $opts \ + --cmd-flag +#^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell + +exec \ + -la name \ +#^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ meta.string.shell string.unquoted.shell +# ^^ punctuation.separator.continuation.line.shell + +exec \ + -la name \ + "$cmd" \ +#^ meta.function-call.arguments.shell +# ^^^^^^ meta.function-call.identifier.shell meta.string.shell +# ^^^ meta.function-call.arguments.shell +# ^^ punctuation.separator.continuation.line.shell + +exec \ + -la name \ + "$cmd" \ + $opts \ +#^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ punctuation.separator.continuation.line.shell + +exec \ + -la name \ + "$cmd" \ + $opts \ + --cmd-flag +#^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell + + +############################################################################### +# 4.2 Bash Builtin Commands (export) # +# https://www.gnu.org/software/bash/manual/bash.html#index-export # +############################################################################### + +export +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^ - meta.function-call + +export foo # 'foo' is a variable name +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ variable.other.readwrite.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -exec >&${tee[1]} 2>&1 -# ^^^ meta.function-call.arguments.shell - meta.interpolation -# ^^^^^^^^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell -# ^^^^^ meta.function-call.arguments.shell - meta.interpolation -# ^^ keyword.operator.assignment.redirection -# ^ punctuation.definition.variable.shell -# ^ punctuation.section.interpolation.begin.shell +export foo bar # 'foo' and 'bar' are variable names +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ variable.other.readwrite.shell +# ^ - variable +# ^^^ variable.other.readwrite.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +export foo='bar' # 'foo' is a variable name +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^ meta.string.shell string.quoted.single.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -#################################################################### -# 3.2.4.2 Conditional Constructs # -#################################################################### +export PGPASSWORD=$(cat "$DOKKU_ROOT/.postgresql/pwd_$APP") +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string - meta.interpolation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.shell meta.interpolation.command.shell +# ^^^^^^^^^^ meta.variable.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ punctuation.definition.variable.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^ variable.function.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell meta.string.shell - if; -#^^ keyword.control.conditional.if.shell - if& -#^^ keyword.control.conditional.if.shell - if| -#^^ keyword.control.conditional.if.shell - if>/dev/null -#^^ keyword.control.conditional.if.shell - if - -#^^ keyword.control.conditional.if.shell - if- -#^^^ - keyword.control - -if -#^^^ - keyword.control - if+ -#^^^ - keyword.control - if$ -#^^^ - keyword.control - if$var -#^^^^^^ - keyword.control - if= -#^^^ - keyword.control - if-= -#^^^^ - keyword.control - if+= -#^^^^ - keyword.control - if() -#^^ keyword.control.conditional.if.shell - if[] -#^^^^ - keyword.control - if{} -#^^^^ - keyword.control +export -f foo +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^ meta.function-call.arguments.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^ meta.variable.shell variable.function.shell - then; -#^^^^ keyword.control.conditional.then.shell - then& -#^^^^ keyword.control.conditional.then.shell - then| -#^^^^ keyword.control.conditional.then.shell - then>/dev/null -#^^^^ keyword.control.conditional.then.shell - then - -#^^^^ keyword.control.conditional.then.shell - then- -#^^^^^ - keyword.control -- then -#^^^^^ - keyword.control - then+ -#^^^^^ - keyword.control - then$ -#^^^^^ - keyword.control - then$var -#^^^^^^^^ - keyword.control - then= -#^^^^^ - keyword.control - then-= -#^^^^^^ - keyword.control - then+= -#^^^^^^ - keyword.control - then() -#^^^^ keyword.control.conditional.then.shell - then[] -#^^^^^^ - keyword.control - then{} -#^^^^^^ - keyword.control +export PATH="$PATH:$HOME/.local/bin" +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +# ^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string +# ^ string.quoted.double punctuation.definition.string.begin +# ^^^^^ meta.interpolation.parameter variable.other.readwrite +# ^ punctuation.definition.variable +# ^ string.quoted.double punctuation.separator.sequence +# ^^^^^ meta.interpolation.parameter variable.other.readwrite +# ^ punctuation.definition.variable +# ^^^^^^^^^^^^ string.quoted.double +# ^ punctuation.definition.string.end -if cmd && \ - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if cmd && - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if cmd || \ - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if cmd || - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if \ - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if !cmd -# ^ punctuation.definition.history.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -! cmd -# <- keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -!cmd -# <- punctuation.definition.history.shell -#^^^ meta.function-call.identifier.shell variable.function.shell -! \ -# <- keyword.operator.logical.shell -# ^ punctuation.separator.continuation.line.shell -! \ - cmd -#^^^ meta.function-call.identifier.shell variable.function.shell -!\ -# <- punctuation.definition.history.shell -#^ punctuation.separator.continuation.line.shell -!\ - cmd -#^^^ meta.function-call.identifier.shell variable.function.shell -!! -# <- variable.language.history.shell punctuation.definition.history.shell -#^ variable.language.history.shell -!-1 -# <- variable.language.history.shell punctuation.definition.history.shell -#^^ variable.language.history.shell -!51 -# <- variable.language.history.shell punctuation.definition.history.shell -#^^ variable.language.history.shell +export PATH="$PATH:~/.local/bin" +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^ string.quoted.double punctuation.definition.string.begin +# ^^^^^ meta.interpolation.parameter variable.other.readwrite +# ^ punctuation.definition.variable +# ^ string.quoted.double punctuation.separator.sequence +# ^ punctuation.definition.string.end -[ ] -# <- support.function.test.begin.shell -# ^ support.function.test.end.shell +export SOMETHING='/etc/test:/var/test:../foo:./foo' +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +# ^^^^^^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single +# ^ punctuation.definition.string.begin +# ^ punctuation.separator.sequence +# ^ punctuation.separator.sequence +# ^ punctuation.separator.sequence +# ^ punctuation.definition.string.end -[ -] -# <- meta.conditional.shell support.function.test.end.shell +export SOMETHING=/etc/test:/var/test +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +# ^^^^^^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^^^^^^^^^^^^^^^^^^^ meta.string string.unquoted +# ^ punctuation.separator.sequence + +msg="Count: ${count}" +# ^ meta.string string.quoted.double - punctuation.separator + +url="https://sublimetext.com/" +# ^ meta.string string.quoted.double - punctuation.separator + +############################################################################### +# 4.2 Bash Builtin Commands (locsl) # +# https://www.gnu.org/software/bash/manual/bash.html#index-local # +############################################################################### + +local +#<- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^ - meta.declaration.variable +local; +#^^^^ keyword.declaration.variable.shell +local& +#^^^^ keyword.declaration.variable.shell +local| +#^^^^ keyword.declaration.variable.shell +local>/dev/null +#^^^^ keyword.declaration.variable.shell +local - +#^^^^ keyword.declaration.variable.shell +local() +#^^^^ keyword.declaration.variable.shell +local[] +#^^^^^^ - storage - keyword.declaration +local{} +#^^^^^^ - storage - keyword.declaration +local- +#^^^^^ - storage - keyword.declaration +-local +#^^^^^ - storage - keyword.declaration +local+ +#^^^^^ - storage - keyword.declaration +local$ +#^^^^^ - storage - keyword.declaration +local$var +#^^^^^^^^ - storage - keyword.declaration +local= +#^^^^^ - storage - keyword.declaration +local-= +#^^^^^^ - storage - keyword.declaration +local+= +#^^^^^^ - storage - keyword.declaration -! [ ] -# <- keyword.operator.logical.shell -# ^ support.function.test.begin.shell -# ^ support.function.test.end.shell +local foo bar # 'foo' and 'bar' are variable names +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -![ ] -# <- punctuation.definition.history.shell -#^ support.function.test.begin.shell -# ^ support.function.test.end.shell +local foo bar='baz' # 'foo' and 'bar' are variable names +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^ meta.string.shell string.quoted.single.shell +# ^ - comment - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -[[ ]] -# <- support.function.test.begin.shell -#^ support.function.test.begin.shell -# ^^ support.function.test.end.shell +local foo+=10 bar-=true +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^^ keyword.operator.assignment.shell +# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^^ keyword.operator.assignment.shell +# ^^^^ constant.language.boolean.shell -[[ -]] -# <- meta.conditional.shell support.function.test.end.shell -#^ meta.conditional.shell support.function.test.end.shell +local pid="$(cat "$PIDFILE" 2>/dev/null)" +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell -! [[ ]] -# <- keyword.operator.logical.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell +local -fn foo +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^ meta.variable.shell variable.function.shell -![[ ]] -# <- punctuation.definition.history.shell -#^^^^^ meta.conditional.shell -#^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell +f() { + local -a "$@" + # <- keyword.declaration.variable.shell + #^^^^ keyword.declaration.variable.shell + # ^^ meta.parameter.option.shell variable.parameter.option.shell + # ^^^^ meta.string.shell + local x + # <- keyword.declaration.variable.shell + #^^^^ keyword.declaration.variable.shell + # ^ meta.variable.shell variable.other.readwrite.shell -if [[ expr ]] && [[ expr ]] || [[ expr ]] ; then cmd ; fi -# ^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell + for x; do + case $x in + $1) + local "$x"'+=(1)' ;;& + # <- keyword.declaration.variable.shell + # ^^^ punctuation.terminator.case.clause.shell + $2) + local "$x"'+=(2)' ;& + # <- keyword.declaration.variable.shell + # ^^ punctuation.terminator.case.clause.shell + $3) + local "$x"'+=(3)' ;; + # <- keyword.declaration.variable.shell + # ^^ punctuation.terminator.case.clause.shell + $1|$2) + local "$x"'+=(4)' + # <- keyword.declaration.variable.shell + esac + # <- meta.function.shell meta.compound.shell meta.conditional.case.shell + # <- keyword.control.conditional.end.shell -if [[ expr && expr || expr ]] ; then cmd ; fi -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell + IFS=, local -a "$x"'=("${x}: ${'"$x"'[*]}")' + # ^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^ meta.string.shell string.unquoted.shell + # ^ keyword.declaration.variable.shell + done + # <- meta.function.shell meta.compound.shell + # <- keyword.control.loop.end.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell -if [[ expr && ( expr || expr ) ]] ; then cmd ; fi -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^^^^^^^^^^^^ meta.group.shell -# ^^ support.function.test.begin.shell -# ^^ keyword.operator.logical.shell -# ^ punctuation.section.group.begin.shell -# ^^ keyword.operator.logical.shell -# ^ punctuation.section.group.end.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -[[ ! ($line == ^0[1-9]$) ]] -# <- meta.conditional.shell - meta.group -#^^^^ meta.conditional.shell - meta.group -# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp -# ^^^^^^^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell -# ^ meta.conditional.shell meta.group.shell - meta.string -# ^^^ meta.conditional.shell - meta.group -# +############################################################################### +# 4.2 Bash Builtin Commands (readonly) # +# https://www.gnu.org/software/bash/manual/bash.html#index-readonly # +############################################################################### -[[ ! ($line != \() ]] -# <- meta.conditional.shell - meta.group -#^^^^ meta.conditional.shell - meta.group -# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp -# ^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell constant.character.escape.shell -# ^ meta.conditional.shell meta.group.shell - meta.string -# ^^^ meta.conditional.shell - meta.group -# +readonly foo # 'foo' is a variable name +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^^ meta.declaration.variable.shell +# ^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +#^^^^^^^ keyword.declaration.variable.shell +# ^ - storage - variable +# ^^^ variable.other.readwrite +# ^ - variable -if [[ $- =~ *i* ]] ; then echo shell is not interactive; fi -#^ keyword.control.conditional.if.shell -# ^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^^^^^ - meta.string.regexp -# ^^^ meta.string.regexp.shell -# ^^^ - meta.string.regexp -# ^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ support.function.test.begin.shell -# ^^ meta.interpolation.parameter.shell variable.language.shell -# ^ punctuation.definition.variable.shell -# ^^ keyword.operator.comparison.shell -# ^ invalid.illegal.unexpected-quantifier.regexp.shell -# ^ keyword.operator.quantifier.regexp.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^^^^ support.function.echo.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +readonly -f foo # 'foo' is a variable name +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^^ meta.declaration.variable.shell +# ^^^^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +#^^^^^^^ keyword.declaration.variable.shell +# ^ - storage - variable +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ meta.variable.shell variable.function.shell +# ^ - variable -if [[ "$ERL_TOP" != ";"; ]];then;fi -#^ keyword.control.conditional.if.shell -# ^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^^^^^^^^^^^^^ - meta.string.regexp -# ^^^^ meta.string.regexp.shell -# ^^^ - meta.string.regexp -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +foo=`readonly x=5` +# <- variable.other.readwrite +# ^ meta.interpolation.command.shell punctuation.section.interpolation.begin.shell +# ^^^^^^^^ meta.interpolation.command.shell keyword.declaration.variable.shell +# ^ meta.interpolation.command.shell variable.other.readwrite +# ^ meta.interpolation.command.shell keyword.operator.assignment +# ^ meta.string.shell meta.interpolation.command.shell meta.declaration.variable.arguments.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ meta.interpolation.command.shell punctuation.section.interpolation.end.shell -if [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; then PLATFORM=docker; fi -#^ keyword.control.conditional.if.shell -# ^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^^ meta.function-call.identifier.shell variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string string.unquoted.shell -if { [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; }; then PLATFORM=docker; fi -#^ keyword.control.conditional.if.shell -# ^ punctuation.section.compound.begin.shell -# ^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^^ meta.function-call.identifier.shell variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string string.unquoted.shell +############################################################################### +# 4.2 Bash Builtin Commands (typeset) # +# https://www.gnu.org/software/bash/manual/bash.html#index-typeset # +############################################################################### + +typeset foo # 'foo' is a variable name +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell +# ^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +#^^^^^^ keyword.declaration.variable.shell +# ^ - storage - variable +# ^^^ variable.other.readwrite +# ^ - variable +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -if ( [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2 ); then PLATFORM=docker; fi -#^ keyword.control.conditional.if.shell -# ^ punctuation.section.compound.begin.shell -# ^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^^ meta.function-call.identifier.shell variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string string.unquoted.shell +typeset -f _init_completion > /dev/null && complete -F _upto upto +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^ - meta.declaration - meta.function-call +# ^^^^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option.shell +# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell +# ^ keyword.operator.assignment.redirection.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^ variable.function.shell +# ^^ variable.parameter.option.shell -if [ ! -f q4m-$Q4MVER.tar.gz ]; then -# ^ support.function.test.begin.shell -# ^ keyword.operator.logical.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell -# ^ - keyword.operator -# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell - : -# ^ meta.function-call.identifier.shell support.function.colon.shell -fi -# <- keyword.control.conditional.end.shell -if true ; then false ; fi -#^ keyword.control.conditional.if.shell -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (test) # +# https://www.gnu.org/software/bash/manual/bash.html#index-test # +############################################################################### -if (ruby extconf.rb && -# ^ punctuation.section.compound.begin.shell - { make clean || true; } && - # <- punctuation.section.compound.begin.shell - # ^ punctuation.section.compound.end.shell - make) 1> build.log 2>&1 - # ^ punctuation.section.compound.end.shell - # ^ - variable.function -fi +test +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^ - meta.function-call +test; +#^^^ support.function.test.shell +test& +#^^^ support.function.test.shell +test| +#^^^ support.function.test.shell +test>/dev/null +#^^^ support.function.test.shell +test - +#^^^ support.function.test.shell +test() +#^^^ support.function.test.shell +test[] +#^^^^^ - support.function +test{} +#^^^^^ - support.function +test- +#^^^^ - support.function +-test +#^^^^ - support.function +test+ +#^^^^ - support.function +test$ +#^^^^ - support.function +test$var +#^^^^^^^ - support.function +test= +#^^^^ - support.function +test-= +#^^^^^ - support.function +test+= +#^^^^^ - support.function -if [ "$1" != "" -a "$2" != "" ]; then -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -#^ keyword.control.conditional.if.shell -# <- keyword.control.conditional.if.shell -# ^ support.function.test.begin.shell +test $var != 0 +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp +# ^ - meta.function-call # ^^ keyword.operator.comparison.shell -# ^^ meta.conditional.shell variable.parameter.option.shell -# ^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell - local DIR=$1 - # <- keyword.declaration.variable.shell - # ^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^ variable.other.readwrite.shell - local TARGET=$2 - # <- keyword.declaration.variable.shell - # ^^^^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^ variable.other.readwrite.shell -elif [ "$1" ]; then -# <- keyword.control.conditional.elseif.shell -# ^^^^^^^^ meta.conditional.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell - local DIR=$PWD - # <- keyword.declaration.variable.shell - # ^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^^^ variable.other.readwrite.shell - local TARGET=$1 - # <- keyword.declaration.variable.shell - # ^^^^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^ variable.other.readwrite.shell -fi -# <- keyword.control.conditional.end.shell +# ^ constant.numeric.value.shell -asdf foo && FOO=some-value pwd -# <- meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^^^ meta.string.shell string.unquoted.shell -# ^^^ meta.function-call.identifier.shell support.function.pwd.shell +test $var == true +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp +# ^^ keyword.operator.comparison.shell +# ^^^^ constant.language.boolean.shell -(cd Layer1-linux && PLATFORM=${PLATFORM} ./build ) && -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -(cd Layer2-nodejs && PLATFORM=${PLATFORM} ./build ) && -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -(cd Layer3-base && PLATFORM=${PLATFORM} ./build ) && -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -(cd Layer4-custom && PLATFORM=${PLATFORM} name=${NOSN} ./build ) || err $? -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^^ meta.function-call.arguments.shell -# ^^ variable.language.shell +test str == "str" +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ string.quoted.double.shell -#################################################################### -# Case Statements # -#################################################################### +test var[0] != var[^0-9]*$ +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp -case- -# <- - keyword -#^^^^ - keyword +test $var[0] != var[^0-9]*$ +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^^ - meta.interpolation - meta.item-access - punctuation +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp -esac -# <- keyword.control.conditional.end.shell -#^^^ keyword.control.conditional.end.shell - meta.conditional.case +test ${var[0]} != var[^0-9]*$ +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^ meta.interpolation.parameter.shell +# ^^^ variable.other.readwrite.shell +# ^^^ meta.item-access.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp -case -# <- meta.conditional.case.shell keyword.control.conditional.case.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.case.shell +test expr -a expr -o expr -- | cmd |& cmd +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ - keyword +# ^ keyword.operator.assignment.pipe.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.assignment.pipe.shell -esac -# <- meta.conditional.case.shell keyword.control.conditional.end.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +test ! $line == ^[0-9]+$ +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell - meta.function-call.arguments +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier +# ^ - meta.function-call +#^^^ support.function.test.shell +# ^ keyword.operator.logical.shell +# ^^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^ meta.string.shell string.unquoted.shell -case var in - ( patt ( esac -#^ meta.conditional.case.shell -# ^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.group -# ^^ meta.conditional.case.clause.patterns.shell meta.group.regexp.shell -# ^^^^ meta.conditional.case.shell -# ^ keyword.control.conditional.patterns.begin.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -# ^ - meta.conditional +test ! $line =~ ^[0-9]+$ >> /file +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell - meta.function-call.arguments +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier - meta.group +# ^ - meta.function-call +#^^^ support.function.test.shell +# ^ keyword.operator.logical.shell +# ^^^^^ variable.other.readwrite.shell +# ^^ invalid.illegal.operator.shell +# ^^^^^^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.assignment.redirection.shell +if test expr -a expr ; then echo "success"; fi +# ^ - meta.function-call +# ^^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^^^^ support.function.echo.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -case # comment -#^^^^^^^^^^^^^^^^ meta.conditional.case.shell -#^^^ keyword.control.conditional.case.shell -# ^^^^^^^^^^ comment.line.number-sign.shell - var # comment -#^^^^^^^^^^^^^^^^ meta.conditional.case.shell -# ^^^^^^^^^^ comment.line.number-sign.shell - in # comment -#^^^^^^^^^^^^^^^^^ meta.conditional.case.shell -# ^^ keyword.control.in.shell -# ^^^^^^^^^^ comment.line.number-sign.shell - pattern) # comment -#^ meta.conditional.case.shell -# ^^^^^^^^ meta.conditional.case.clause.patterns.shell -# ^^^^^^^^^^^ meta.conditional.case.clause.commands.shell -# ^^^^^^^^^^ comment.line.number-sign.shell -esac -# <- meta.conditional.case.shell keyword.control.conditional.end.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +if test "$VAR" != ";";then;fi +# ^ - meta.function-call +# ^^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^ meta.string.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.quoted.double.shell +# ^^^^^^^^ - meta.function-call +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell +let test -z $2 && { } +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^ - meta.function-call - meta.compound +# ^^^ meta.compound.shell - meta.function-call +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.logical.shell +# ^ punctuation.section.compound.begin.shell +# ^ punctuation.section.compound.end.shell -case "$1" in -# <- keyword.control.conditional.case.shell -#^^^ keyword.control.conditional.case.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell punctuation.definition.variable.shell -# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^^ keyword.control.in.shell -setup ) -# <- - variable.function - support.function - meta.function-call -# ^ keyword.control.conditional.patterns.end.shell -echo Preparing the server... -# <- meta.function-call support.function.echo -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -dep\ -loy ) -# <- - variable.function - support.function - meta.function-call -# ^ keyword.control.conditional.patterns.end.shell -echo Deploying... -# <- meta.function-call support.function.echo -# ^^^^^^^^^^^^^ meta.function-call.arguments -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -* ) -# <- constant.other.wildcard.asterisk.shell -# ^ keyword.control.conditional.patterns.end.shell -cat <<'ENDCAT' -# <- meta.function-call.identifier.shell variable.function.shell -# ^^ meta.function-call.arguments.shell - meta.string - meta.tag -# ^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^ punctuation.definition.tag.begin.shell - entity -# ^^^^^^ entity.name.tag.heredoc.shell -# ^ punctuation.definition.tag.end.shell - entity +let $var == test -z $5 && cmd +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^ - meta.function-call +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.logical.shell +# ^^^ variable.function.shell -foo -# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell -ENDCAT -# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -esac -# <- meta.conditional.case.shell keyword.control.conditional.end.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +let 'test -z $2 && { }' +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^ - meta.compound +# ^ - meta.function-call +# ^ string.quoted.single.shell punctuation.definition.string.begin.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.logical.shell +# ^ string.quoted.single.shell punctuation.definition.string.end.shell +let '$var == test -z \'$5\' && cmd' +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^ string.quoted.single.shell punctuation.definition.string.begin.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ constant.character.escape.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ constant.character.escape.shell +# ^^ keyword.operator.logical.shell +# ^^^ - variable.function +# ^ string.quoted.single.shell punctuation.definition.string.end.shell -case "${foo}" in- in_ in=10 in -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.case.shell -# <- keyword.control.conditional.case.shell -#^^^ keyword.control.conditional.case.shell -# ^^ - keyword.control.in -# ^^ - keyword.control.in -# ^^ - keyword.control.in -# ^^ keyword.control.in - ( help | h ) bar ;; -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell -# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - # <- keyword.control.conditional.patterns.begin.shell - # ^ keyword.control.conditional.patterns.end.shell - # ^^ punctuation.terminator.case.clause.shell - do1 ) foo1 ;& -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell -# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - # ^ keyword.control.conditional.patterns.end.shell - # ^^ punctuation.terminator.case.clause.shell - (do2 ) foo2 ;;& -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell -# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - # <- keyword.control.conditional.patterns.begin.shell - # ^ keyword.control.conditional.patterns.end.shell - # ^^^ punctuation.terminator.case.clause.shell - *) bar -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell - #^ keyword.control.conditional.patterns.end.shell -esac -# <- keyword.control.conditional.end.shell +let "$var != test -z '$5' && cmd" +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^ string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ string.quoted.single.shell +# ^^ keyword.operator.logical.shell +# ^^^ - variable.function +# ^ string.quoted.double.shell punctuation.definition.string.end.shell -case $TERM in - sun-cmd) - # ^ keyword.control.conditional.patterns.end.shell - update_terminal_cwd() { print -Pn "\e]l%~\e\\" };; - # ^ meta.function punctuation.section.compound.end.shell - # ^^ punctuation.terminator.case.clause.shell - *xterm*|rxvt|(dt|k|E)term) - # ^ constant.other.wildcard.asterisk.shell - # ^ keyword.operator.logical.regexp.shell - # ^ keyword.operator.logical.regexp.shell - # ^ punctuation.definition.group.begin.regexp.shell - # ^ keyword.operator.logical.regexp.shell - # ^ keyword.operator.logical.regexp.shell - # ^ punctuation.definition.group.end.regexp.shell - # ^ keyword.control.conditional.patterns.end.shell - update_terminal_cwd() { print -Pn "\e]2;%~\a" };; - # ^ meta.function punctuation.section.compound.end.shell - # ^^ punctuation.terminator.case.clause.shell - *) - # <- constant.other.wildcard.asterisk.shell - #^ keyword.control.conditional.patterns.end.shell - update_terminal_cwd() {};; - # ^ meta.function punctuation.section.compound.end.shell - # ^^ punctuation.terminator.case.clause.shell -esac -# <- keyword.control.conditional.end.shell -case $SERVER in -# <- keyword.control.conditional.case.shell -ws-+([0-9]).host.com) echo "Web Server" -#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell -# ^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^ keyword.operator.quantifier.regexp.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^ punctuation.definition.set.begin.regexp.shell -# ^^^ constant.other.range.regexp.shell -# ^ punctuation.separator.sequence.regexp.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ punctuation.definition.group.end.regexp.shell -# ^ keyword.control.conditional.patterns.end.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -db-+([0-9])\.host\.com) echo "DB server" -#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell -# ^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^ keyword.operator.quantifier.regexp.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^ punctuation.definition.set.begin.regexp.shell -# ^^^ constant.other.range.regexp.shell -# ^ punctuation.separator.sequence.regexp.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ punctuation.definition.group.end.regexp.shell -# ^ keyword.control.conditional.patterns.end.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -bk-+([0-9])\.host\.com) echo "Backup server" -# ^ keyword.operator.quantifier.regexp.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^ punctuation.definition.set.begin.regexp.shell -# ^^^ constant.other.range.regexp.shell -# ^ punctuation.separator.sequence.regexp.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ punctuation.definition.group.end.regexp.shell -# ^ keyword.control.conditional.patterns.end.shell -# ^^^^ support.function.echo.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -*)echo "Unknown server" -# <- constant.other.wildcard.asterisk.shell -#^ keyword.control.conditional.patterns.end.shell -# ^^^^ support.function.echo.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -esac -# <- keyword.control.conditional.end.shell -#^^^ keyword.control.conditional.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (unalias) # +# https://www.gnu.org/software/bash/manual/bash.html#index-unalias # +############################################################################### -case $_G_unquoted_arg in -*[\[\~\#\&\*\(\)\{\}\|\;\<\>\?\'\ ]*|*]*|"") -#^ punctuation.definition.set.begin.regexp.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ - keyword.control - _G_quoted_arg=\"$_G_unquoted_arg\" - ;; -*) - _G_quoted_arg=$_G_unquoted_arg -;; -esac -case $1 in -*[\\\`\"\$]*) -#^ punctuation.definition.set.begin.regexp.shell -# ^^^^^^^^ constant.character.escape.shell -# ^ punctuation.definition.set.end.regexp.shell - _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; -*) - _G_unquoted_arg=$1 ;; -esac +unalias +unalias -a -b +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function +# ^^ variable.parameter.option.shell +# ^^ invalid.illegal.parameter.shell +unalias foo +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable -#################################################################### -# select loops # -#################################################################### +unalias foo # comment +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^ - meta.function +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^^^^^^^^ comment.line.number-sign.shell -select var in 1 2 3 4 5; do echo $i; done; -# <- keyword.control.loop.select.shell -# ^^^ variable.other.readwrite.shell -# ^^ keyword.control.in.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ support.function.echo.shell -# ^^ variable.other.readwrite.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.loop.end.shell -# ^ punctuation.terminator.statement.shell +unalias foo b"a"r b'a'z 7za +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable -select fname in *; -# <- keyword.control.loop.select.shell -#^^^^^ keyword.control.loop.select.shell -# ^^ keyword.control.in.shell -# ^ meta.string.shell string.unquoted.shell -# ^ punctuation.terminator.statement.shell -do -# <- keyword.control.loop.do.shell - echo you picked $fname \($REPLY\) -# ^^^^ meta.function-call.identifier.shell support.function.echo.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call - break; -# ^^^^^ keyword.control.flow.break.shell -# ^ punctuation.terminator.statement.shell -done -# <- keyword.control.loop.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (unset) # +# https://www.gnu.org/software/bash/manual/bash.html#index-unset # +############################################################################### -#################################################################### -# while loops # -#################################################################### +unset +unset foo b'a'r ba${z} # 'foo' and 'bar' are variable names +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^ meta.variable.shell - meta.string +# ^^^ meta.variable.shell meta.string.shell +# ^ meta.variable.shell - meta.string +#^^^^ support.function.unset.shell +# ^ - meta.variable - support - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - meta.variable - variable +# ^^^^^ variable.other.readwrite.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell +# ^ - meta.variable - variable +# ^^ meta.variable.shell - meta.interpolation +# ^^^^ meta.variable.shell meta.interpolation.parameter.shell +# ^ - meta.variable - variable +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -while true; do -# <- keyword.control.loop.while -#^^^^ keyword.control.loop.while.shell -# ^ - constant - keyword -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell - break -# ^^^^^ keyword.control.flow.break.shell - break 2; -# ^^^^^ keyword.control.flow.break.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell - continue -# ^^^^^^^^ keyword.control.flow.continue.shell - continue 2; -# ^^^^^^^^ keyword.control.flow.continue.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell -done -# <- keyword.control.loop.end +unset -n +unset -nfv foo +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^^^ support.function.unset.shell +# ^^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ variable.function.shell +# ^ - variable -while ! true; do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ support.function.echo.shell +unset -f -n -v foo b'a'r; unset -vn foo 2>& /dev/null +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ - meta.function-call +# ^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^ - meta.string +# ^^^ meta.string.shell +# ^ - meta.string +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ variable.function.shell +# ^ - variable +# ^^^^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^^ support.function.unset.shell +# ^ - support - variable +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell + +unset -f -x +v -- foo bar; unset -vn -- foo +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ - meta.function-call +# ^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ invalid.illegal.parameter.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ - variable +# ^^ keyword.operator.end-of-options.shell +# ^^^ variable.function.shell +# ^ - variable +# ^^^ variable.function.shell # ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.loop.end.shell +# ^^^^^ support.function.unset.shell +# ^ - support - variable +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ - variable +# ^^ keyword.operator.end-of-options.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable -while ! { true; }; do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell +unset- +# <- - support.function +unset+ +# <- - support.function +unset() +# <- support.function.unset.shell +unset[] +# <- - support.function +unset{} +# <- - support.function +unset= +# <- - support.function +unset+= +# <- - support.function +unset-= +# <- - support.function -while ! { [[ true ]]; }; do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell -while ! ( [[ true ]] ); do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell -# ^^ support.function.test.end.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell +############################################################################### +# Linux builtins # +############################################################################### -while read -r -d '' f; do -# <- keyword.control.loop.while.shell -# ^^^^ support.function.read.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ string.quoted.single.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -done -# <- keyword.control.loop.end.shell +sudo rm -rf +# <- meta.function-call.identifier.shell support.function.sudo.shell +#^^^ meta.function-call.identifier.shell support.function.sudo.shell +# ^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^ meta.function-call.arguments.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell -while IFS= read -r -d '' f; do -# <- keyword.control.loop.while.shell -# ^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^ support.function.read.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ string.quoted.single.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -done -# <- keyword.control.loop.end.shell +sudo -b -g network --host=$foo rm -rf +# <- meta.function-call.identifier.shell support.function.sudo.shell +#^^^ meta.function-call.identifier.shell support.function.sudo.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +# ^^^^^^^ meta.string.shell string.unquoted.shell +# ^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ punctuation.definition.parameter.shell +# ^ keyword.operator.assignment.shell +# ^^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ variable.function.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +sudo --reset-timestamp -n -f -- rm -rf +# <- meta.function-call.identifier.shell support.function.sudo.shell +#^^^ meta.function-call.identifier.shell support.function.sudo.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^^^^^^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ invalid.illegal.parameter.shell +# ^^ keyword.operator.end-of-options.shell +# ^^ variable.function.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell -#################################################################### -# do...until loops # -#################################################################### -do echo bar; until ! { [[ true ]]; } -# <- keyword.control.loop.do.shell -# ^^^^^ keyword.control.loop.until.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^ punctuation.section.compound.end.shell +############################################################################### +# 6.4 Bash Conditional Expressions # +############################################################################### +[ ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^ meta.conditional.shell +# ^ support.function.test.end.shell -#################################################################### -# for loops # -#################################################################### +[ -a file ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^ meta.conditional.shell -for; -#^^ keyword.control.loop.for.shell -for& -#^^ keyword.control.loop.for.shell -for| -#^^ keyword.control.loop.for.shell -for>/dev/null -#^^ keyword.control.loop.for.shell -for - -#^^ keyword.control.loop.for.shell -for() -#^^ keyword.control.loop.for.shell -for[] -#^^^^ - keyword.control -for{} -#^^^^ - keyword.control -for- -#^^^ - keyword.control --for -#^^^ - keyword.control -for+ -#^^^ - keyword.control -for$ -#^^^ - keyword.control -for$var -#^^^^^^ - keyword.control -for= -#^^^ - keyword.control -for-= -#^^^^ - keyword.control -for+= -#^^^^ - keyword.control +[ -v varname ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell - do; -#^^ keyword.control.loop.do.shell - do& -#^^ keyword.control.loop.do.shell - do| -#^^ keyword.control.loop.do.shell - do>/dev/null -#^^ keyword.control.loop.do.shell - do - -#^^ keyword.control.loop.do.shell - do() -#^^ keyword.control.loop.do.shell - do[] -#^^^^ - keyword.control - do{} -#^^^^ - keyword.control - do- -#^^^ - keyword.control - -do -#^^^ - keyword.control - do+ -#^^^ - keyword.control - do$ -#^^^ - keyword.control -do$var -#^^^^^^ - keyword.control - do= -#^^^ - keyword.control - do-= -#^^^^ - keyword.control - do+= -#^^^^ - keyword.control +[ file1 -ef file2 ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for done -# <- keyword.control.loop.for.shell -#^^ keyword.control.loop.for.shell -# ^^^^ keyword.control.loop.end.shell +[ file1 -nt file2 ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ file1 -ot file2 ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ ! str != str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^ meta.conditional.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ str != str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ str == str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for do done -# <- keyword.control.loop.for.shell -#^^ keyword.control.loop.for.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell +[ str =~ str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ invalid.illegal.operator.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for x; do -#<- keyword.control.loop.for.shell -#^^ keyword.control.loop.for.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell - echo "${!x}" -# ^^^^ meta.function-call.identifier.shell support.function.echo.shell -# ^^^^^^^^ meta.function-call.arguments.shell -done -#<- keyword.control.loop.end.shell +[ str = str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for (( i = 0; i < 10; i++ )); do -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell -# <- keyword.control.loop.for.shell -# ^^ punctuation.section.arithmetic.begin.shell -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation -# ^ punctuation.terminator.statement.shell -# ^ keyword.operator.comparison.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.operator.arithmetic.shell -# ^^ punctuation.section.arithmetic.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell - echo $i - # <- meta.function-call support.function.echo.shell - # ^ meta.function-call.arguments punctuation.definition.variable.shell - # ^ meta.function-call.arguments variable.other.readwrite.shell -done -# <- keyword.control.loop.end.shell -for (( i = 0; i < 10; i++ )) #; do -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell -# <- keyword.control.loop.for.shell -# ^^ punctuation.section.arithmetic.begin.shell -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation -# ^ punctuation.terminator.statement.shell -# ^ keyword.operator.comparison.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.operator.arithmetic.shell -# ^^ punctuation.section.arithmetic.end.shell -# ^^^^^^ comment.line.number-sign.shell -do -#<- keyword.control.loop.do.shell - echo $i - # <- meta.function-call support.function.echo.shell - # ^ meta.function-call.arguments punctuation.definition.variable.shell - # ^ meta.function-call.arguments variable.other.readwrite.shell -done -# <- keyword.control.loop.end.shell +[ str < str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for i in str1 $str2 "str3" 'str4' st$r5; do echo $i; done; -# <- keyword.control.loop.for.shell -# ^ variable.other.readwrite.shell -# ^^ keyword.control.in.shell -# ^^^^ meta.string.shell string.unquoted.shell -# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^^^^^ meta.string.shell string.quoted.double.shell -# ^^^^^^ meta.string.shell string.quoted.single.shell -# ^^ meta.string.shell string.unquoted.shell -# ^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ meta.function-call.identifier.shell support.function.echo.shell -# ^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.loop.end.shell -# ^ punctuation.terminator.statement.shell +[ str > str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for i in >=b, a&=b, a^=b, a|=b )) +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ variable.other.readwrite.shell +# ^ meta.arithmetic punctuation.separator +# ^ variable.other.readwrite.shell +# ^^ keyword.operator.assignment.augmented.shell +# ^ variable.other.readwrite.shell +# ^ meta.arithmetic punctuation.separator +# ^^ keyword.operator.assignment.augmented.shell +# ^ meta.arithmetic +# ^^ keyword.operator.assignment.augmented.shell +# ^ meta.arithmetic +# ^^ keyword.operator.assignment.augmented.shell +# ^ meta.arithmetic punctuation.separator +# ^^ keyword.operator.assignment.augmented.shell +# ^^^ keyword.operator.assignment.augmented.shell +# ^^^ keyword.operator.assignment.augmented.shell +# ^^ keyword.operator.assignment.augmented.shell +# ^^ keyword.operator.assignment.augmented.shell +# ^^ keyword.operator.assignment.augmented.shell +(( a++ a ++ )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell +(( a-- a -- )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell +(( ++a ++ a )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell +(( --a -- a )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell -# Escaped and non-escaped backticks in heredocs... -cat << backticks_are_deprecated -#^^^^^^ - meta.string - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^ - entity - keyword -# ^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entity -foo=\`pwd\` -#^^^^^^^^^^^ meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^ constant.character.escape.shell -# ^^ constant.character.escape.shell -foo=`pwd` -#^^^ meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.interpolation.command.shell - string.unquoted.heredoc -# ^ punctuation.section.interpolation.begin.shell -# ^ punctuation.section.interpolation.end.shell -backticks_are_deprecated -#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +(( a/b a / b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a%b a % b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a+b a + b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a-b a - b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a*b a * b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a**16 a ** 16 )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell -# Redirection after heredoc token -cat << redirection_comes_next > foo.txt -#^^^^^^ - meta.string - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^^^^^^^^^^^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^ - entiy - keyword -# ^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entiy - keyword -# ^ keyword.operator.assignment.redirection.shell -# ^^^^^^^ - variable.function -hello -# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell -redirection_comes_next -#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +(( ~1 )) +# ^ keyword.operator.bitwise.shell +(( a&b a & b)) +# ^ keyword.operator.bitwise.shell +# ^ keyword.operator.bitwise.shell +(( a^b a ^ b)) +# ^ keyword.operator.bitwise.shell +# ^ keyword.operator.bitwise.shell +(( a|b a | b)) +# ^ keyword.operator.bitwise.shell +# ^ keyword.operator.bitwise.shell +(( a<<12 a << 16 )) +# ^^ keyword.operator.bitwise.shell +# ^^ keyword.operator.bitwise.shell +(( a>>14 a >> 14 )) +# ^^ keyword.operator.bitwise.shell +# ^^ keyword.operator.bitwise.shell + +(( a<=b a <= b )) +# ^^ keyword.operator.comparison.shell +# ^^ keyword.operator.comparison.shell +(( a>=b a >= b )) +# ^^ keyword.operator.comparison.shell +# ^^ keyword.operator.comparison.shell +(( ab a > b )) +# ^ keyword.operator.comparison.shell +# ^ keyword.operator.comparison.shell + +(( !1 ! 1 )) +# ^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +(( a&&b a && b )) +# ^^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +(( a||b a || b )) +# ^^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell + +(( a ? 0 : 1 )) +# ^ keyword.operator.ternary.shell +# ^ keyword.operator.ternary.shell +(((a>b) ? (a>c?a:c) : (b>c?b:c))) +# <- meta.arithmetic.shell punctuation.section.arithmetic.begin.shell - meta.group +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell +# ^^^^^ meta.group.shell +# ^^^ - meta.group.shell +# ^^^^^^^^^ meta.group.shell +# ^^^ - meta.group.shell +# ^^^^^^^^^ meta.group.shell +# ^^ - meta.group.shell +#^ punctuation.section.arithmetic.begin.shell +# ^ punctuation.section.group.begin.shell +# ^ keyword.operator.comparison.shell +# ^ punctuation.section.group.end.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.begin.shell +# ^ keyword.operator.comparison.shell +# ^ keyword.operator.ternary.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.end.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.begin.shell +# ^ keyword.operator.comparison.shell +# ^ keyword.operator.ternary.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.end.shell +# ^^ punctuation.section.arithmetic.end.shell -cat << FARAWAY -#^^^^^^^^^^ - meta.string - meta.tag -# ^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^^^^^ - entiy - keyword -# ^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entity -foo -# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell -FARAWAY -#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +((a+=b)) +# ^ - string.unquoted -cat <<- INDENTED -#^^^^^^^ - meta.string - meta.tag -# ^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^^ keyword.operator.assignment.redirection.shell -# ^ - entity - keyword -# ^^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entity - say what now ${foo} -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.interpolation.parameter.shell - string - INDENTED -# <- meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag -#^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +let 5 \ + + 5 +#^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^ keyword.operator.arithmetic.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -cat <<- 'indented_without_expansions' -#^^^^^^^^ - meta.string - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^^ keyword.operator.assignment.redirection.shell -# ^ punctuation.definition.tag.begin.shell - entity -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell -# ^ punctuation.definition.tag.end.shell - entity - ${foo} -#^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^^ - variable.other - indented_without_expansions -#^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +let 5+5 # comment +#^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^ support.function.let.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ keyword.operator.arithmetic.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -variable=$(cat <$dummy.c -#^^ meta.function-call.identifier.shell variable.function.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - string.unquoted.heredoc -# ^^^^^^^^^^^ meta.string.shell string.quoted.single.shell -# ^^^^ - meta.string -# ^^^ meta.string.heredoc.shell meta.tag.heredoc.shell -# ^^^^^^^^^^ meta.string.heredoc.shell - meta.tag -# ^^ keyword.operator.assignment.redirection.shell -# ^^^ entity.name.tag.heredoc.shell -# ^ keyword.operator.assignment.redirection.shell -# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF -# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +%1 +# <- meta.interpolation.job.shell variable.language.job.shell punctuation.definition.variable.shell +#^ meta.interpolation.job.shell variable.language.job.shell -#################################################################### -# Misc statement tests # -#################################################################### +############################################################################### +# Misc statement tests # +############################################################################### function clk { typeset base=/sys/class/drm/card0/device