Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Printf builtin missing v flag support
- X-seq: zsh-workers 37471
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: "Starms, William Albert (MU-Student)" <williamstarms@xxxxxxxxxxxxxxxxx>
- Subject: Re: Printf builtin missing v flag support
- Date: Fri, 1 Jan 2016 18:45:16 +0000
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=doIarPLbDrgN9jpEnVLunhcU6X9REgMI030dwKVcXJc=; b=DMWpUaDkJWIuebmN8rjy/pLaJpOVfMHS9LODkEtWCFytpEJrKIFihJ8nTAnE0Q2Zmj YNpjQgARqeMuvyLa0oIx05n0jrRfRSkq6kWjtVX+ZYT/ScWT2KlxixcAorCr7X7fxB3w wb/D6prlc4DlvKE2I5GA1Ja8AlmHHuFAlsGYGOXkW58M4NefDlm8k+1Uvzr+DVWzIf6i lJOrdTmnQCuyYXu8sRHqO0Jj+MW0SNVlt2y7UvEDA8ZW8j6h6yl/1YNUoKb9Rb8mKGbX NwecvKiT9JJZ7N5+AAKbt3DbmyEel5cI3qlimFsfLrg1T41SPmPQsJubSnIrDFO9T9yX HHPg==
- In-reply-to: <etPan.5684d62f.51cb8f6f.31ec@Ganymede>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: "Starms, William Albert (MU-Student)" <williamstarms@xxxxxxxxxxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <etPan.5684d3d1.74f2df6b.31ec@Ganymede> <etPan.5684d62f.51cb8f6f.31ec@Ganymede>
2015-12-31 07:16:00 +0000, Starms, William Albert (MU-Student):
> I had a script malfunctioning on me and printing “-v” to
> stdout, and I found that it’s because zsh (version 5.2)
> doesn’t seem to support the v flag that bash has. I did some
> digging through GNU's bash source and it seems to have been
> added somewhere between 3.0 and 3.1. According to the bash
> documentation:
>
> printf: printf [-v var] format [arguments]
[...]
Yes, that's a bash-specific feature.
See also ksh93 where:
var=$(printf format arg)
doesn't involve a fork nor pipe (but still trims the trailing
newline characters)
ksh93 tries to only fork to execute external commands. For
builtins when used in command substitutions, ksh93 just adds
their output to the substituted value without actually going
through the whole actual printing through a pipe and reading at
the other end.
That avoids having to add a -v for every builtin command.
$(...) still creates a subshell environment though.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author