bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "builtin jobs" does not output to stdout.


From: Oğuz
Subject: Re: "builtin jobs" does not output to stdout.
Date: Mon, 13 Feb 2023 21:32:14 +0200

13 Şubat 2023 Pazartesi tarihinde Koichi Murase <myoga.murase@gmail.com>
yazdı:

> One of the
> cases that the fork cost of $() becomes a problem and that other
> languages cannot be really used is the prompt setting `PS1' containing
> command substitutions.


Bash has many escape sequences to enrich your prompt strings. If they don't
meet your needs and you find yourself embedding so many command
substitutions in them that there is a discernible delay, perhaps it's time
you give other shells a try. I hear fish is good.

An example is a shell function: a shell
> function can change the global variables (or previous-scope variables
> with Bash's dynamic scoping) and, at the same time, can output data to
> stdout. When one wants to capture the stdout of such a function while
> keeping the changes made to the global variables, the command
> substitution cannot be directly used.


It's not a good example because there isn't much difference between `f() {
list; }; x=$(f)' and `x=$(list)', they both read the output of `list' into
`x'. When is it absolutely necessary to both retain the side effects of
`list' and save its output to a variable?

Anyway, if there are no use cases or no benefits at all, ksh didn't
> have the feature.
>

Ksh has many features no one ever uses; some of them don't make any sense,
some don't even work. Check out <https://github.com/ksh93/ksh>, it's a mess
compared to bash.


-- 
Oğuz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]