Posted: . At: 9:21 AM. This was 6 years ago. Post ID: 12239
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



Interesting bash bug with a certain script.


This script triggers an interesting result with bash versus sh.

(echo '\n' && echo "echo '\n'" > foo.sh && sh foo.sh)|wc -l

Running it with /bin/bash.

jason@Yog-Sothoth » Documents » $ (echo '\n' && echo "echo '\n'" > foo.sh && sh foo.sh)|wc -l
3

Running it with /bin/sh.

$ (echo '\n' && echo "echo '\n'" > foo.sh && sh foo.sh)|wc -l
4

This is a very strange bug, but just small differences between the bash and sh shells. Something to be aware of I guess. This should really not affect the Linux OS as a whole, scripts are very well written on Linux and there should be nothing to worry about.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.