2010-09-23 01:06:00 +04:00
|
|
|
Simple commands:
|
|
|
|
|
|
|
|
$ echo foo
|
|
|
|
foo
|
2010-11-08 03:35:40 +03:00
|
|
|
$ printf 'oh no'
|
|
|
|
oh no (no-eol)
|
2010-09-23 03:20:47 +04:00
|
|
|
$ printf 'bar\nbaz\n' | cat
|
2010-09-23 01:06:00 +04:00
|
|
|
bar
|
|
|
|
baz
|
|
|
|
|
|
|
|
Multi-line command:
|
|
|
|
|
|
|
|
$ foo() {
|
|
|
|
> echo bar
|
|
|
|
> }
|
|
|
|
$ foo
|
|
|
|
bar
|
|
|
|
|
2011-11-07 23:46:41 +04:00
|
|
|
Return codes before inline python:
|
|
|
|
|
2012-01-27 06:00:32 +04:00
|
|
|
$ sh -c 'exit 1'
|
2011-11-07 23:46:41 +04:00
|
|
|
[1]
|
|
|
|
|
2011-10-13 19:54:38 +04:00
|
|
|
Doctest commands:
|
|
|
|
|
|
|
|
>>> print 'foo'
|
|
|
|
foo
|
|
|
|
$ echo interleaved
|
|
|
|
interleaved
|
|
|
|
>>> for c in 'xyz':
|
|
|
|
... print c
|
|
|
|
x
|
|
|
|
y
|
|
|
|
z
|
|
|
|
>>> print
|
2011-11-07 23:46:41 +04:00
|
|
|
|
2011-10-13 19:54:38 +04:00
|
|
|
|
2010-09-23 01:06:00 +04:00
|
|
|
Regular expressions:
|
|
|
|
|
|
|
|
$ echo foobarbaz
|
|
|
|
foobar.* (re)
|
|
|
|
$ echo barbazquux
|
|
|
|
.*quux.* (re)
|
|
|
|
|
2010-09-23 01:06:02 +04:00
|
|
|
Globs:
|
|
|
|
|
2010-09-23 03:20:47 +04:00
|
|
|
$ printf '* \\foobarbaz {10}\n'
|
2010-09-23 01:06:02 +04:00
|
|
|
\* \\fo?bar* {10} (glob)
|
|
|
|
|
2010-09-23 01:06:00 +04:00
|
|
|
Literal match ending in " (re)":
|
|
|
|
|
|
|
|
$ echo 'foo (re)'
|
|
|
|
foo (re)
|
|
|
|
|
|
|
|
Exit code:
|
|
|
|
|
2010-09-25 23:52:17 +04:00
|
|
|
$ (exit 1)
|
2010-09-23 01:06:00 +04:00
|
|
|
[1]
|