sh read command eats backslashes in input?

Accrding to: http://www.vias.org/linux-knowhow/bbg_sect_08_02_01.html : -r If this option is given, backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation. It works on my machine. $ echo ‘\&|’ | while read -r in; do … Read more

What does the line “#!/bin/sh” mean in a UNIX shell script?

It’s called a shebang, and tells the parent shell which interpreter should be used to execute the script. #!/bin/sh <——— bourne shell compatible script #!/usr/bin/perl <– perl script #!/usr/bin/php <— php script #!/bin/false <—— do-nothing script, because false returns immediately anyways. Most scripting languages tend to interpret a line starting with # as comment and … Read more