Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sed has undefined behavior if input does not ed with new line #30

Open
smondet opened this issue Dec 20, 2016 · 0 comments
Open

sed has undefined behavior if input does not ed with new line #30

smondet opened this issue Dec 20, 2016 · 0 comments

Comments

@smondet
Copy link
Member

smondet commented Dec 20, 2016

{sh| printf "$(printf '%%s' %s | sed -e 's/\(.\{3\}\)/\\\1/g')" |sh}

Here we use the fact that $( ) removes the last new-line that sed potentially added (OSX does add it; GNU sed doesn't)

cf. http://stackoverflow.com/questions/13325138/why-does-sed-add-a-new-line-in-osx
& http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html (definition of "Text file")

smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.

And `"s:.*/\\([^\\?\\/]*\\)\\??.*:\\1:"` was wrong
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.

And `"s:.*/\\([^\\?\\/]*\\)\\?.*:\\1:"` was wrong
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.

And `"s:.*/\\([^\\?\\/]*\\)\\?.*:\\1:"` was wrong
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.

And `"s:.*/\\([^\\?\\/]*\\)\\?.*:\\1:"` was wrong
smondet added a commit that referenced this issue Dec 20, 2016
Add downloader example test to the Travis script

This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30.

The `sed` call to get the filename out of the URL was also wrong and
non-portable.

This also fixes the `curl` invocation, cf. #31.
smondet added a commit that referenced this issue Dec 21, 2016
This fixes issue #29.

The example had a bashism while using `sed`; cf. also #30 and
function `no_newline_sed`.
The `sed` expression to get the filename out of the URL was also wrong and
non-portable.

This also fixes the `curl` invocation, cf. #31.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant