| 1 |
# TODO-deprecate: Code we want to get rid of!
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
shopt -p | grep simple_word
|
| 7 |
shopt --set oil:upgrade
|
| 8 |
shopt -p | grep simple_word
|
| 9 |
|
| 10 |
shopt --unset ysh:upgrade
|
| 11 |
shopt -p | grep simple_word
|
| 12 |
|
| 13 |
## STDOUT:
|
| 14 |
shopt -u simple_word_eval
|
| 15 |
shopt -s simple_word_eval
|
| 16 |
shopt -u simple_word_eval
|
| 17 |
## END
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
shopt --set parse_at
|
| 23 |
|
| 24 |
var x = %(one two)
|
| 25 |
echo @x
|
| 26 |
|
| 27 |
## STDOUT:
|
| 28 |
one two
|
| 29 |
## END
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
shopt --set ysh:upgrade
|
| 34 |
|
| 35 |
if ('foo42' ~ / <capture d+> /) {
|
| 36 |
echo $[_match(0)]
|
| 37 |
echo $[_group(0)]
|
| 38 |
}
|
| 39 |
|
| 40 |
## STDOUT:
|
| 41 |
42
|
| 42 |
42
|
| 43 |
## END
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
shopt --set ysh:upgrade
|
| 48 |
|
| 49 |
f() {
|
| 50 |
return 42
|
| 51 |
}
|
| 52 |
|
| 53 |
try {
|
| 54 |
f
|
| 55 |
}
|
| 56 |
echo status=$_status
|
| 57 |
|
| 58 |
## STDOUT:
|
| 59 |
status=42
|
| 60 |
## END
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
source --builtin osh/two.sh
|
| 66 |
echo status=$?
|
| 67 |
|
| 68 |
## STDOUT:
|
| 69 |
status=0
|
| 70 |
## END
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
if test -n "$OIL_VERSION"; then
|
| 75 |
echo OIL
|
| 76 |
fi
|
| 77 |
|
| 78 |
## STDOUT:
|
| 79 |
OIL
|
| 80 |
## END
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
seq 3 | for line in (io.stdin) {
|
| 86 |
echo $line
|
| 87 |
}
|
| 88 |
## STDOUT:
|
| 89 |
1
|
| 90 |
2
|
| 91 |
3
|
| 92 |
## END
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
echo $[_io=>captureStdout(^(echo hi))]
|
| 98 |
|
| 99 |
## STDOUT:
|
| 100 |
hi
|
| 101 |
## END
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
echo $['foo' => upper()]
|
| 106 |
|
| 107 |
## STDOUT:
|
| 108 |
FOO
|
| 109 |
## END
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
var mylist = []
|
| 115 |
call mylist=>append('foo')
|
| 116 |
call mylist.append('bar')
|
| 117 |
|
| 118 |
pp test_ (mylist)
|
| 119 |
|
| 120 |
## STDOUT:
|
| 121 |
(List) ["foo","bar"]
|
| 122 |
## END
|
| 123 |
|