sh script writing help

Aiza aiza21 at comclark.com
Sun May 30 06:10:40 UTC 2010


Dan Nelson wrote:
> In the last episode (May 30), Aiza said:
>> In a .sh type script I have && exerr " very long message gt 250 char" 
>> all on the same line. This is a real pain to edit.
>>
>> Is there some code a can use to continue this on the next line so I can 
>> see it on the screen and still have the command function? I tried \ with 
>> no luck.
> 
> \ should work just fine:
> 
> $ echo "long line \
> split onto two"
> long line split onto two
> $
> 


You example works only because the continuation starts at position 1.

$   [ -n "${test-name-fowarding}" -o -n "${test-noname}" ] || \
     exerr "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
this is for ease of reading the code but will display with a bunch of 
spaces in the middle of the sentence. The \ works fine bypassing all 
white space between code not so for white space between the "  ".

Is there a coding method to get around this?


More information about the freebsd-questions mailing list