Date: Sun, 30 May 2010 13:17:30 +0700 From: "Anh Ky Huynh" <xkyanh@gmail.com> To: Aiza <aiza21@comclark.com> Cc: "questions@freebsd.org" <questions@freebsd.org> Subject: Re: sh script writing help Message-ID: <20100530131730.1931dbd4@icy.localdomain> In-Reply-To: <4C02015C.5070605@comclark.com> References: <4C01F419.10100@comclark.com> <20100530053935.GG8866@dan.emsphone.com> <4C02015C.5070605@comclark.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 30 May 2010 14:10:36 +0800
Aiza <aiza21@comclark.com> wrote:
> 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?
Do you try to read your expression from a file?
	exerr `cat /path/to/data`
the contents of /path/to/data are your very long string.
Regards,
-- 
Anh Ky Huynh
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100530131730.1931dbd4>
