🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.user
Article #544

Re: beeps and other sounds

#544
From: Greg Wooledge
Date: Mon, 16 Nov 2026 13:00
27 lines
3098 bytes
On Mon, Nov 16, 2026 at 13:34:09 +0100, Vincent Lefevre wrote:
> On 2026-11-16 12:44:55 +0100, Nicolas George wrote:
> > The escaping if fragile, it relies on the fact that a is not a special
> > character for escaping and therefore the backslash in front of it will
> > not have its special semantic.
> 
> Yes, but AFAIK, this is valid. At least code like
> 
>   printf "...\n"
> 
> is very common in shell scripts (including /bin/sh ones).

It's technically wrong, but it works in every shell I've seen, so
people keep using it.

Single quotes are preferred there, both for the \ preservation, and
to discourage people from using expansions in the printf format
argument.  printf "$myvar\\n" is far worse, unless myvar is tightly
controlled and designed to be used as a printf format argument.

printf '%s\n' "$myvar" is one correct way to write it.
printf %s\\n "$myvar" is another.
printf "%s\\n" "$myvar" is another, but I really don't recommend this one.

If you're confused about whether you should be using one \ or two \\,
that's exactly why single quotes are recommended.  Then you always know
you want one \, which will be passed along literally.
Technical Details
Message-ID: <O04tr-cfJv-27@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-lon.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!newsfeed.xs3.de!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <Jz190-2w6T-7@gated-at.bofh.it> <Jz74J-2ClB-3@gated-at.bofh.it> <O03e1-cf3m-3@gated-at.bofh.it> <O03nH-cf7Q-7@gated-at.bofh.it> <O04a5-cfAO-3@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-lon.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!newsfeed.xs3.de!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Greg Wooledge <greg@wooledge.org>
Newsgroups: linux.debian.user
Subject: Re: beeps and other sounds
Date: Mon, 16 Nov 2026 14:00:01 +0100
Message-ID: <O04tr-cfJv-27@gated-at.bofh.it>
References: <Jz190-2w6T-7@gated-at.bofh.it> <Jz74J-2ClB-3@gated-at.bofh.it> <O03e1-cf3m-3@gated-at.bofh.it> <O03nH-cf7Q-7@gated-at.bofh.it> <O04a5-cfAO-3@gated-at.bofh.it>
X-Original-To: debian-user@lists.debian.org
X-Mailbox-Line: From debian-user-request@lists.debian.org  Mon Nov 16 12:54:33 2026
Old-Return-Path: <greg@wooledge.org>
X-Amavis-Spam-Status: No, score=-1.9 tagged_above=-10000 required=5.3
 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no
X-Policyd-Weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 CL_IP_EQ_FROM_MX=-3.1; rate: -4.6
Mail-Followup-To: debian-user@lists.debian.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/832930
List-ID: <debian-user.lists.debian.org>
List-URL: <https://lists.debian.org/debian-user/>
List-Archive: https://lists.debian.org/msgid-search/avr8-gKZTx-g27RE@wooledge.org
Approved: robomod@news.nic.it
Lines: 27
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 16 Nov 2026 07:54:18 -0500
X-Original-Message-ID: <avr8-gKZTx-g27RE@wooledge.org>
X-Original-References: <BYAPR12MB28083B81ACF7B2E5EB5E2368BA402@BYAPR12MB2808.namprd12.prod.outlook.com>
 <CAO6YxPzgFFzwO5dHGwewxiXRwBgM1=JM_fLZ0MFAr-saowao=Q@mail.gmail.com>
 <20261116113803.GF670644@qaa.vinc17.org>
 <avrstzwgDRtEhgBH@phare.normalesup.org>
 <20261116123409.GG670644@qaa.vinc17.org>