| 1 | ## our_shell: ysh |
| 2 | |
| 3 | #### ysh usage |
| 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 |