| 1 |
## our_shell: ysh
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
set +o errexit
|
| 6 |
|
| 7 |
$SH --location-str foo.hay --location-start-line 42 -c 'echo ()' 2>err.txt
|
| 8 |
|
| 9 |
cat err.txt | grep -o -- '-- foo.hay:42: Unexpected'
|
| 10 |
|
| 11 |
|
| 12 |
# common idiom is to use -- to say it came from a file
|
| 13 |
$SH --location-str '[ stdin ]' --location-start-line 10 -c 'echo "line 10";
|
| 14 |
echo ()' 2>err.txt
|
| 15 |
|
| 16 |
cat err.txt | fgrep -o -- '-- [ stdin ]:11: Unexpected'
|
| 17 |
|
| 18 |
## STDOUT:
|
| 19 |
-- foo.hay:42: Unexpected
|
| 20 |
line 10
|
| 21 |
-- [ stdin ]:11: Unexpected
|
| 22 |
## END
|
| 23 |
|
| 24 |
|
| 25 |
$SH --debug-file $TMP/debug.txt -c 'true'
|
| 26 |
grep 'Oils started with' $TMP/debug.txt >/dev/null && echo yes
|
| 27 |
## stdout: yes
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
echo '(BAD' > no-quoting
|
| 32 |
echo '(BAD' > 'with spaces.sh'
|
| 33 |
echo '(BAD' > $'bad \xff'
|
| 34 |
|
| 35 |
write -n '' > err.txt
|
| 36 |
|
| 37 |
$SH no-quoting 2>>err.txt || true
|
| 38 |
$SH 'with spaces.sh' 2>>err.txt || true
|
| 39 |
$SH $'bad \xff' 2>>err.txt || true
|
| 40 |
|
| 41 |
egrep --only-matching '^.*:1' err.txt
|
| 42 |
|
| 43 |
## STDOUT:
|
| 44 |
no-quoting:1
|
| 45 |
"with spaces.sh":1
|
| 46 |
b'bad \yff':1
|
| 47 |
## END
|