OILS / spec / divergence.test.sh View on Github | oils.pub

57 lines, 16 significant
1## compare_shells: bash dash mksh zsh ash
2## oils_failures_allowed: 2
3
4# This file relates to:
5#
6# - doc/known-differences.md
7# - "divergence" tag on github:
8# https://github.com/oils-for-unix/oils/issues?q=is%3Aissue%20state%3Aopen%20label%3Adivergence
9
10#### xz package: dirprefix="${line##*([}"
11
12# https://oilshell.zulipchat.com/#narrow/channel/502349-osh/topic/alpine.20xz.20-.20.22.24.7Bline.23.23*.28.5B.7D.22.20interpreted.20as.20extended.20glob/with/519718284
13
14# NOTE: spec/extglob-match shows that bash respects it
15#
16# echo 'strip ##' ${x##@(foo)}
17
18shopt -s extglob
19
20
21dirprefix="${line##*([}"
22echo "-$dirprefix-"
23
24# Now try with real data
25line='*([foo'
26dirprefix="${line##*([}"
27echo "-$dirprefix-"
28
29## STDOUT:
30--
31-foo-
32## END
33
34## N-I mksh/zsh status: 1
35## N-I mksh/zsh STDOUT:
36## END
37
38
39#### ((( with nested subshells
40
41# https://oilshell.zulipchat.com/#narrow/channel/502349-osh/topic/.28.28.28.20not.20parsed.20like.20bash/with/518874141
42
43# spaces help
44good() {
45 cputype=`( ( (grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
46}
47
48bad() {
49 cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
50 #echo cputype=$cputype
51}
52
53good
54bad
55
56## STDOUT:
57## END