mirror of
https://github.com/vim/vim
synced 2025-05-02 22:37:47 +02:00
Problem: Insufficient testing for syntax plugins. Solution: Add shell file examples. (Charles Campbell) Create a messages file for easier debugging and reporting the test results.
33 lines
971 B
Bash
33 lines
971 B
Bash
#!/bin/ksh
|
|
# Test variable modifiers
|
|
# Variable=value
|
|
Variable='value'
|
|
Variable="value"
|
|
VariableA="pat1xxpat2"
|
|
VariableB="pat2xxpat1"
|
|
echo ${#}
|
|
echo ${#VariableA}
|
|
echo ${VariableA#pat1}
|
|
echo ${VariableA##pat1}
|
|
echo ${VariableB%pat1}
|
|
echo ${VariableB%%pat1}
|
|
|
|
# This gets marked as an error
|
|
Variable=${VariableB:+${VariableC:=eng}} # :+ seems to work for ksh as well as bash
|
|
Variable=${VariableB:-${VariableC:-eng}} # :- is ksh and bash
|
|
|
|
# This is OK
|
|
Variable='${VariableB:+${VariableC:=eng}}'
|
|
Variable='${VariableB:-${VariableC:-eng}}'
|
|
Variable="${VariableB:+${VariableC:=eng}}" # :+ seems to work for ksh as well as bash
|
|
Variable="${VariableB:-${VariableC:-eng}}" # :- is ksh and bash
|
|
|
|
# These are OK
|
|
: ${VariableB:-${VariableC:-eng}}
|
|
: "${VariableB:-${VariableC:-eng}}"
|
|
: '${VariableB:-${VariableC:-eng}}'
|
|
|
|
# Another test
|
|
Variable=${VariableB:-${VariableC:-${VariableD:-${VariableE:=eng}}}}
|
|
: ${VariableB:=${VariableC:-${VariableD:-${VariableE:=eng}}}}
|
|
|