sed: Support command lists.

This commit is contained in:
Timothy Sample 2018-12-09 14:08:40 -05:00
parent 1302c8bf28
commit 5be7ed331d
3 changed files with 8 additions and 0 deletions

View File

@ -107,6 +107,8 @@
(define (execute-function function str)
(match function
(('begin . commands)
(execute-commands commands str))
(('s pattern replacement flags)
(substitute str pattern replacement flags))
(_ (error "SED: unsupported function" function))))

View File

@ -0,0 +1,4 @@
input='foo
bar'
echo "$input" | \sed '/foo/ { s/foo/baz/ s/baz/bar/ } s/bar/baz/'

View File

@ -0,0 +1,2 @@
baz
baz