shelljs / shx

Portable Shell Commands for Node
MIT License
1.72k stars 44 forks source link

sed does not accept a blank replacement string #109

Closed bardiharborow closed 7 years ago

bardiharborow commented 7 years ago

After upgrading to shx 0.2.1, i.e. a version with the fixed sed syntax, I can't replace strings with a blank string. The issue is likely in these regex.

shx echo 'foobar' | shx sed 'bar' '' # previous syntax, returned 'foo'
shx echo 'foobar' | shx sed 's/bar/lish/' # returns 'foolish'
shx echo 'foobar' | shx sed 's/bar/ /' # returns 'foo '
shx echo 'foobar' | shx sed 's/bar//' # crashes with 'sed: invalid replacement string'
echo 'foobar' | sed 's/bar//' # returns 'foo'
nfischer commented 7 years ago

Ah, I can reproduce shx sed 's/bar//'. Everything else is working as intended. Thanks for reporting this, I'll look into it.