[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] make function local
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] make function local |
Date: |
Fri, 10 Apr 2015 11:09:23 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Apr 10, 2015 at 09:13:17AM -0500, Eduardo A. Bustamante López wrote:
> Now, for the features in bash that'd be actually useful:
>
> - discipline functions and compound datatypes (like in ksh)
> - a way to do wrap arbitrary OS system calls with a builtin, so that instead
> of
> having thousands of builtins each interacting with the system, we could just
> do: `syscall lstat foo' and get something useful.
(Even adding *just* examples/loadables/finfo as a standard builtin would
be so helpful! But we also get a huge number of requests for readlink.)
> - a faster implementation of the variable lookup code
> - a shopt to disable evaluation of shell code in places like arithmetic
> expansion
> - a better way to deal with binary input (specially NUL bytes)
> - and many more, these are the ones I can think of right now
Yeah, same here. I didn't know I was going to be quizzed on this, or
I would have studied.
- Fix the $"..." security hole (I tried and failed).
http://www.gnu.org/software/gettext/manual/html_node/bash.html
- Pass caller-scope scalar and array variable names to a function, and
use them in the called function safely (like declare -n except safe
to use) (like ksh's nameref).
- User-specified delimiter character on readarray/mapfile (I hear this is
already done).
- Sorting arrays without having to call nonstandard GNU sort -z.
- printf '%(%s)T' or equivalent support on systems that don't have %s
in strftime() (because those systems also don't have date +%s).
- Multi-character join, like "${array[*]}" but using more than just the
first character of IFS. (Like [join $list ", "] in Tcl.)
(Currently, can be hacked by doing
printf -v tmp "%s, " "${array[@]}"
tmp=${tmp%, }
so not a high priority.)
As someone who has never used languages with "local functions", I don't
really see what good they are. I certainly wouldn't put them at the
top of any "new feature" list.
- Re: [Help-bash] make function local, Peng Yu, 2015/04/09
- Re: [Help-bash] make function local, Chet Ramey, 2015/04/10
- Re: [Help-bash] make function local, Eduardo A . Bustamante López, 2015/04/12
- Re: [Help-bash] make function local, Chet Ramey, 2015/04/13
- Re: [Help-bash] make function local, Chet Ramey, 2015/04/16
- Bash performance when declaring variables (was: Re: [Help-bash] make function local), Eduardo A . Bustamante López, 2015/04/16
- Re: Bash performance when declaring variables, Chet Ramey, 2015/04/17
- Re: Bash performance when declaring variables, Eduardo A . Bustamante López, 2015/04/17