Imported from ../bash-2.05b.tar.gz.
This commit is contained in:
parent
f73dda092b
commit
7117c2d221
362 changed files with 34387 additions and 15063 deletions
85
tests/nquote3.tests
Normal file
85
tests/nquote3.tests
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
a=$'a\001b'
|
||||
|
||||
set $a
|
||||
|
||||
b=$a
|
||||
c=$1
|
||||
d="$1"
|
||||
|
||||
e=$'uv\001\001wx'
|
||||
f=$'uv\001w\001xy'
|
||||
|
||||
set $e $e
|
||||
|
||||
recho ${e%%??}
|
||||
recho "${e%%??}"
|
||||
|
||||
recho ${e%%???}
|
||||
recho "${e%%???}"
|
||||
|
||||
recho ${a#?}
|
||||
recho "${a#?}"
|
||||
|
||||
# simple variables
|
||||
|
||||
recho ${f##*$'\001'}
|
||||
recho "${f##*$'\001'}"
|
||||
recho ${f##*''} # literal ^A
|
||||
recho "${f##*'^A'}" # two characters, `^' and `A'
|
||||
|
||||
recho ${e%$'\001'*}
|
||||
recho "${e%$'\001'*}"
|
||||
recho ${e#*$'\001'}
|
||||
recho "${e#*$'\001'}"
|
||||
|
||||
# array members
|
||||
|
||||
arr[0]=$e
|
||||
arr[1]=$f
|
||||
|
||||
recho ${arr[1]##*$'\001'}
|
||||
recho "${arr[1]##*$'\001'}"
|
||||
recho ${arr[1]##*''} # literal ^A
|
||||
recho "${arr[1]##*'^A'}" # two characters, `^' and `A'
|
||||
|
||||
recho ${arr[0]%$'\001'*}
|
||||
recho "${arr[0]%$'\001'*}"
|
||||
recho ${arr[0]#*$'\001'}
|
||||
recho "${arr[0]#*$'\001'}"
|
||||
|
||||
recho ${arr%$'\001'*}
|
||||
recho "${arr%$'\001'*}"
|
||||
recho ${arr#*$'\001'}
|
||||
recho "${arr#*$'\001'}"
|
||||
|
||||
# positional parameters
|
||||
|
||||
set $e $f
|
||||
|
||||
recho ${2##*$'\001'}
|
||||
recho "${2##*$'\001'}"
|
||||
recho ${2##*''} # literal ^A
|
||||
recho "${2##*''}" # literal ^A
|
||||
recho ${2##*'^A'} # two characters, `^' and `A'
|
||||
recho "${2##*'^A'}" # two characters, `^' and `A'
|
||||
|
||||
recho ${1%$'\001'*}
|
||||
recho "${1%$'\001'*}"
|
||||
recho ${1#*$'\001'}
|
||||
recho "${1#*$'\001'}"
|
||||
|
||||
recho ${@%$'\001'*}
|
||||
recho "${@%$'\001'*}"
|
||||
recho ${@#*$'\001'}
|
||||
recho "${@#*$'\001'}"
|
||||
recho ${@##*''} # literal ^A
|
||||
recho "${@##*'^A'}" # two characters, `^' and `A'
|
||||
|
||||
# arrays treated as a whole
|
||||
|
||||
recho ${arr[@]%$'\001'*}
|
||||
recho "${arr[@]%$'\001'*}"
|
||||
recho ${arr[@]#*$'\001'}
|
||||
recho "${arr[@]#*$'\001'}"
|
||||
recho ${arr[@]##*''} # literal ^A
|
||||
recho "${arr[@]##*'^A'}" # two characters, `^' and `A'
|
||||
Loading…
Add table
Add a link
Reference in a new issue