From nobody Mon Sep 04 14:54:14 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RfWqr4C6lz4ryY3 for ; Mon, 4 Sep 2023 14:54:16 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RfWqr3jV1z3J7W; Mon, 4 Sep 2023 14:54:16 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693839256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=inPY0KWPQV3yX7BlNR+jFROqPUKpyIGcJ2XvG46fvWE=; b=bzCVOS9ocY6KNSRW/oWvDk302lCNfbABENUY3TaD6DpynROoNCVxr+2ZhNlRRHi2/tAnqA DASDYBfIun8X1FbjjJmgvaVCU9+i7ZqGDZyDvp9XrbDPDAH8iSem4+HIbKixUs6CJpeb3R E6OX90c9FeNrGW7Cm0I9/xdGYT5eMyNCdzBUnGknoX3NuoQBKyv4bEzJyPkPcsuBth7Po9 HaO4SZKZcCaD7tm/beyCeyu7po9v1vh7D5x7t+BwpcCoHwj4rMZ5RHkKk8cWP4bFvl3r4U G2Y3jYgOcoV9hNlZGHPV+MT27GrSQ0YejhFEeqlFQ3wLrB5OZYROIl00n8777A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693839256; a=rsa-sha256; cv=none; b=EY3xlSebN6ma2vSyjwX+ZwqR8kG8uo8zv1bLK9algOvbATy29/s5IzMUNUtCXwQNvbauTg qjx/O4y4ADozMaz0aFDnQvS/28mH633Oi9gUkNeTUOmAERFyOP0J8Lj+oaCV1ouBpPSOyt xnxfoSPY1PqUK/ef/hquHvR0e9h0EyPTa0gvHWUZx5f3Jft6Jca9VQ8qoNplC7yezxySjy n+HLCkEdPmAXmdzRUlXfcXQvYVZgqJxBPD2TEsAZOYLsqHZ6YtX7Hf/C6uAA3dcJNYAv74 4KdVB9jEvh691V4SHYusSrC8yRPv+Ia2Zd3D071MGuOMSI/uP/UUzNeXC7GgEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693839256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=inPY0KWPQV3yX7BlNR+jFROqPUKpyIGcJ2XvG46fvWE=; b=bg9ybb+YtxCjVAbn1owJwfSdRPnlM/LMcUy5t95zJiPAoHhETkO/oCu7vA7btBklC9folt iBl6tVv+HNTQOgzA0gEFk14Ril63cuWnDxQ1OybtzDu1ApwP9HK8ToQBxuKPNcKN++Drhi 3VLxQ4IR7NX6bpowwK350tjCKXJ84cf6AE4xsQ2y2fyEt32mmR336BSbGrJtytw3Mhr08h jIIs380hUlAxM6ZmnGro4gh97pxdoai9X4KXgHON7w4zfngRoHh9gyr76pwtFIrp1IIQ9r jCgVGOoLyc+oO7e7Wd2Pgx5cfknUZB4PCbk+H4+04sNoEZoLDfGmcVDrjZI+ew== Received: from ltc.des.no (unknown [IPv6:2001:4647:d671:0:36e8:94ff:feca:9834]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: des) by smtp.freebsd.org (Postfix) with ESMTPSA id 4RfWqr1xGhzqts; Mon, 4 Sep 2023 14:54:16 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.no (Postfix, from userid 1001) id E01254CCD1; Mon, 4 Sep 2023 16:54:14 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ede Wolf Cc: questions@freebsd.org Subject: Re: cut off last lines of a document In-Reply-To: ("Andreas Kusalananda =?utf-8?B?S8OkaMOkcmkiJ3M=?= message of "Mon, 4 Sep 2023 16:50:24 +0200") References: <57be5495-97f8-4f22-9ae2-cd9712596e64@nebelschwaden.de> <86edjet336.fsf@ltc.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Mon, 04 Sep 2023 16:54:14 +0200 Message-ID: <865y4qt2eh.fsf@ltc.des.no> List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "Andreas Kusalananda K=C3=A4h=C3=A4ri" write= s: > Note how this will handle backslash-escaped newlines in the input, and > that, depending on the shell and its configuration, the "echo" call may > or may not expand backslash-escaped characters in the input (e.g. "\n" > and "\t"). The "echo" may also interpret the string "-n" as an option > it occurs on its own line. You may also lose flanking whitespace. Right. If your shell is broken, use read -r and replace echo with printf "%s\n". Or don't use a broken shell. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org