From owner-freebsd-questions@FreeBSD.ORG Sun May 30 06:59:01 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF7081065674 for ; Sun, 30 May 2010 06:59:01 +0000 (UTC) (envelope-from aiza21@comclark.com) Received: from avmxsmtp1.comclark.com (avmxsmtp1.comclark.com [202.69.191.115]) by mx1.freebsd.org (Postfix) with ESMTP id 4BFCE8FC12 for ; Sun, 30 May 2010 06:59:00 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai4WABqpAUzKRa1aPGdsb2JhbAAHh2GWXwEBAQE1vFqFFgSDRg X-IronPort-AV: E=Sophos;i="4.53,327,1272816000"; d="scan'208";a="1014544" Received: from unknown (HELO [10.0.10.3]) ([202.69.173.90]) by avmxsmtp3.comclark.com with ESMTP; 30 May 2010 14:58:59 +0800 Message-ID: <4C020CB2.5070408@comclark.com> Date: Sun, 30 May 2010 14:58:58 +0800 From: Aiza User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Anh Ky Huynh References: <4C01F419.10100@comclark.com> <20100530053935.GG8866@dan.emsphone.com> <4C02015C.5070605@comclark.com> <20100530131730.1931dbd4@icy.localdomain> In-Reply-To: <20100530131730.1931dbd4@icy.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "questions@freebsd.org" Subject: Re: sh script writing help X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 06:59:01 -0000 Anh Ky Huynh wrote: > On Sun, 30 May 2010 14:10:36 +0800 > Aiza 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, > Thanks I never though of that solution.