Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Bourne / bash problem



Here's an interesting work-around that I found.  (Credit to Anon7843, http://unix.derkeiler.com/Newsgroups/comp.unix.solaris/2005-07/0928.html)

$ cat cmts.sh
#!/bin/bash
echo \
"word1 `echo # comment line 1...> /dev/null` \
word2  `echo # comment line 2... > /dev/null` \
word3  `echo # comment line 3... > /dev/null` \
word4  `echo # comment line 4... > /dev/null` "

$ ./cmts.sh
word1  word2   word3   word4

James Lang
PL/X Compiler Development and Testing
IBM Toronto Software Lab

On Sat, Apr 4, 2009 at 7:13 AM, Romeo Theriault <romeo.theriault@example.com> wrote:

somewhere, I cannot escape the end-of line:
   [...]
   a-command \
   # a comment \
   another-command  #  another comment \
   [...]

Do you think there would be a way to include comments in such a situation?

According to my "Portable Shell Programming" book. These situations will not work with comments:

echo "This will not work."   \<space>
echo "This will not work."   \ # Comment
echo "This will not work."   # Comment   \

The above mentioned book is based around the borne shell (sh) but I don't think that bash changed any rules around comments.

--
Romeo Theriault
System Administrator
Information Technology Services

--
To unsubscribe from this mailing list,
please see the instructions at http://www.tlug.jp/list.html

The TLUG mailing list is hosted by the award-winning Internet provider
ASAHI Net.
Visit ASAHI Net's English-language Web page: http://asahi-net.jp/en/


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links