~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to tests/quote1.sub

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# inconsistency with quoted pattern substitution patterns through bash-4.2
 
2
# fixed in a ksh93-compatible (and Posix-compatible, in general) way
 
3
# NOT backwards compatible
 
4
 
 
5
test="weferfds'dsfsdf"
 
6
 
 
7
# why does this work, this list was born of frustration, I tried
 
8
# everything I could think of.
 
9
echo \'${test//"'"/\'\\\'\'}\'" "
 
10
 
 
11
#but none of the following
 
12
 
 
13
echo "'${test//"'"/}'"
 
14
 
 
15
echo "'${test//"'"/"'\\''"}'"
 
16
 
 
17
echo "'${test//"'"/\'\\'\'}'"
 
18
 
 
19
#echo "'${test//'/}'"   # hangs waiting for '
 
20
#echo "'${test//"'"/'\\''}'" # hangs waiting for '
 
21
 
 
22
unset test
 
23
test=teststrtest
 
24
echo "${test//str/"dd dd"}"
 
25
echo ${test//str/"dd '\''dd"}
 
26
 
 
27
unset test
 
28
test=teststring
 
29
 
 
30
echo "${test//str/"dddd"}"
 
31
 
 
32
echo ${test//str/"dddd"}
 
33
 
 
34
echo ${test//str/"'"}
 
35
 
 
36
echo "${test//str/"'"}"
 
37
 
 
38
#echo "${test//str/'}"   # hangs
 
39
 
 
40
test=test\'string
 
41
echo "${test//"'"/"'"}"
 
42
 
 
43
x="a'b'c"; echo "${x//\'/\'}"
 
44
 
 
45
printf '%s\n' "foo ${IFS+"b   c"} baz"
 
46
 
 
47
# this is where the default behavior differs from posix
 
48
set -o posix
 
49
echo "foo ${IFS+'bar} baz"