From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10694 invoked from network); 15 Nov 2021 05:31:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Nov 2021 05:31:53 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1636954313; b=sqcoNz65kaIaqQfxUDCUBCHRQUaQ5SCY/R9OZ2mwpl9outt8R2U4LPzKNx/yrTc0IyeUF9ypdc uGX+0XTmxm4zZ0jZiiftoCQ6CEyNGw1MSPl47ruZfvMucHGvieMh/nmoojHjAGa8B6bnrXrONp UHlv3bgEZEJjShT77hZL27SXV5KO0NAKjRK61IEda5HJcu+hfvLVNrs2W/mPvW7Qn5jyOfMu5k Z12uZA3qStVII0a3rEB9Or7migQirKroanpK1Erm392NZRsrc0j77aG/QYxvrfZnaqgL2DP+nT FNQqbeQMEYjpewBRHhrd9+e9d7IrXqNd04TONy3z6g3fbg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vk1-f175.google.com) smtp.remote-ip=209.85.221.175; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1636954313; bh=K/T7XdGqaaZ897R/xrQ+w1lHpPv3FqvLyLCs5uAlr0k=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=R9GX4cGH3P7v9r2EjeWt5LKojPz/lCGW3eAfmcS6/7urut5hhxLLqzN3jICwQGLCaaXl8SHvkY zNeGGl7mXYgLJOSwdzqa7VpzTQbAGDLCoYqh2HuvH3COa637XPTHnTmxg8XZ7k5ThmQzPnMnbh eqRSz93d28+Lm8kWefs5C0IWbMfPcQr9UH1+lPv6tPUOfduoh9QYRoXkhw9bmeaTLxFFd8W/wV PCPv266d49cBfdh6wDafmK+2Ttksti6TuWazJFmgZiAmH1hpzUk/25d4JfNMPjcxeOIkCAtAg6 gQom8dEYvQKusjhZywSWVTcFrNZyzu1OicP5PSml9FDvqg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:References:In-Reply-To:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=q1jlE6g5ZVfNKQrgJuIPKiuLADrZi7ll/tuDOZlOGtU=; b=k3J9/2IcVdfVr5CZNCOKOadqB6 5ramn7GkDNr3s6xQSkEkPgWfnLqWWI47vuN5ckilHO0vE10Rwds7QrH/6k1NqMNB2R0O9F2kAeQRd b1/aij7/tsQoodADzJVTf6VgNeTWFNuRXTpFbrTDdjULrMmrOxo1b3J8f8i0xv1/TDBs/BP/2/vSK +KUCro25sjrtZrqThPCBX3yjXArt5g7g/xAeUX2IISPk1gR3BRkBf0VeamemglIS8bVULcq0psBso U9rrfT60G7Q9JFRlbX+X7G+9UDG899BIMZi/uSpKO0YeOire1bnqOlOg7T3y7r12ab3o6jUp6p7mn RDvzX80w==; Received: from authenticated user by zero.zsh.org with local id 1mmUat-000IDQ-QU; Mon, 15 Nov 2021 05:31:51 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vk1-f175.google.com) smtp.remote-ip=209.85.221.175; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vk1-f175.google.com ([209.85.221.175]:35666) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mmUZr-000HXF-6s; Mon, 15 Nov 2021 05:30:47 +0000 Received: by mail-vk1-f175.google.com with SMTP id u130so8498887vku.2 for ; Sun, 14 Nov 2021 21:30:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=q1jlE6g5ZVfNKQrgJuIPKiuLADrZi7ll/tuDOZlOGtU=; b=Oj36hTSerbs3hAgmjibdtAa+WncCipP8TA2VY3F3KBQmvULVZFocy3u/pzq5eCrzzG ihKvspTBRwT0JtZiAbStRVoQGj32cvbQCJ69Fuy6mvhJtEpSY96EPmyzJL8bd2hKo2Gm +i0ibiPdB2dae7K/3nHlvfSwTX0HodZVnkng/PQ2YT/YVbyyQEx4JYhBIGeG0bJHYroS oK5mKfdkqGQd7xZLmKqvhvwHPAlqIcWsjC7hfLiXllRxZHXkpeHfGLls4omoMS0ox7MF mBnLt8xtH0ZhWP6MCB97UC4VKI3yUNP4TerBT1oRQgW+gOnjMpxJD+b7RW1vdK8VJgJT /V0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=q1jlE6g5ZVfNKQrgJuIPKiuLADrZi7ll/tuDOZlOGtU=; b=jSzYLplJzcqTOK+3eAZ49W8rEdDqgeY0D58MeC8I1cn2nyzDm59PBo6eLo/zfR3qFI DUOKb5psFO5rwiHhldBWmiG13W9cwMb1U64jyM++/nyfNyRlsgph3y/L7slwLcwU4+4D HHFr4xS5qdbNksEZvf9QUNJmriP7ZMo9JjCRFVyL9c+k7vf9IqCQJeatGQ2+TOUi2ECn qNAp80olMf0YGs9ddPpan1vMtkASv3Pl4oQDUwJA1uLZcHrxTivwkCnmZF1ii8NSUw3v LtbMbKcLxmqqIAVLTk9Uylu57Z7A9IONiWZH6ZrTtkxQS6JsHHa9lidghHIQWlSSSGWD L1AA== X-Gm-Message-State: AOAM532acEg/u+wtJfCghBVR4hF7QM2ta63J+mlG+a/r9b3LImHIpt9v JFv/h6ALmLoKcU/cl4J+tqvQDvEMcyMhJE70zkw= X-Google-Smtp-Source: ABdhPJy88hecKTXtPrcigzfKOdLJ1Fppks0pSUpJ5Kan0z2akHflLpcYmKg7iMuiGyfwG3IBmfu6dd4mK+PtVCgxnRQ= X-Received: by 2002:a1f:b64e:: with SMTP id g75mr53159332vkf.13.1636954246046; Sun, 14 Nov 2021 21:30:46 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ab0:2a82:0:0:0:0:0 with HTTP; Sun, 14 Nov 2021 21:30:45 -0800 (PST) In-Reply-To: <9a8b02e1b7c697101e9be2738590cca99ac02470.camel@ntlworld.com> References: <20211114111957.4514@sachi> <9a8b02e1b7c697101e9be2738590cca99ac02470.camel@ntlworld.com> From: Mikael Magnusson Date: Mon, 15 Nov 2021 06:30:45 +0100 Message-ID: Subject: Re: print built-in doesn't print this. To: Peter Stephenson Cc: jdh , zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 27345 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 11/14/21, Peter Stephenson wrote: > On Sun, 2021-11-14 at 11:19 -0800, jdh wrote: >> I wanted to insert a string of '-'s to visually show a change in a list. >> But I found out that >> >> print "--------" >> >> Does not print anything out. Well maybe a \n. >> Is this intentional? Or a well known feature? > > print has standard option syntax, so you need to terminate > lists of options (even if they're empty) with "--". > > print -- "--------" > > The echo builtin is non-standard and doesn't have this > requirement, but it's non-standard in a different way in > different shells, so I'd recommend getting used to using > print like that. Both print and echo accept a single - to terminate the option list, while print also accepts the double -- as seen above. echo will just print any unknown option, while print will complain about most of them (for some reason, -0 through -9 are just printed verbatim). If you want to be somewhat portable across shells, the printf builtin is usually pretty reliable. Although in many cases the format string cannot begin with a - there either, -- seems universally accepted (I tested bash, dash, zsh and gnu /usr/bin/printf). PS I use this, alias pl='print -rl -' which will print its arguments terminated by newlines, and the -r means to not interpret any escapes. I think alias pl='printf -- %s\\n' would be more or less equivalent. -- Mikael Magnusson