Hi,
I find the docco for return [n] not easy to interpret. Here is what can be read.
return [n]
Stop executing a shell function or sourced file and
return the value specified by n to its caller.
...
Any command associated wit
Hi All,
I posted a question to STKO and someone suggest I should open a 'feature
request' here.
https://stackoverflow.com/questions/68065039/bash-completion-after-a-multiline-string
Thanx in advance,
Phi
May be posting a link is not appropriate so I cut/paste it here
I bumped into this problem regarding bash completion, can't find reference
to it.
When doing
$ echo foo "bar" /tm
I got /tm expanded to /tmp/ that is indeed correct.
But if I do
$ echo foo "bar
more bar" /tm
No completion is don
Meanwhile you may use functions to setup your variables something along
those lines.
PW$ function first-index { echo $1; }
PW$ function last-index { shift $(($#-1)) ; echo $1; }
PW$ declare -a array=([5]="hello" [11]="world" [42]="here")
PW$ declare -i first_index=$(first-index ${!array[@]})
PW$
shell command, so having the same
identifier for a program basename, an alias and a function, I wanted to
make something (a function?) that would tell me
$ word0 echo
echo is an alias
echo is a function
echo is a program (a.out...)
I choosed randomly 'echo' as a test case, I could have used ls, etc
only echo seems to choke.
Cheers,
Phi
I discovered that
$ type -ta word
Would tell me what I wanted i.e all the defs of word :)
On Thu, Jun 24, 2021 at 9:48 AM Phi Debian wrote:
> Hi All,
>
> Dunno if this is a bug or pilot error, I bumped into this.
>
>
> $ type echo
> echo is a shell builtin
>
>
Arghh! I knew it was a pilot error :)
unset PROMPT_COMMAND fix it :)
my PROMPT_COMMAND reference a function that do 'echo' and I should use
"command echo" in the echo function not \echo.
On Thu, Jun 24, 2021 at 10:51 AM Phi Debian wrote:
> I discovered that
>
&
Yes figured the hard way :)
Thanx
On Thu, Jun 24, 2021 at 1:51 PM Greg Wooledge wrote:
> On Thu, Jun 24, 2021 at 09:48:59AM +0200, Phi Debian wrote:
> > $ function echo { \echo the function version; \echo "$@"; }
>
> For the record, this isn't how you write a
Thanx Chet for taking time to explain.
May be readline API should have a way to know that a quote ['"`] is opened
ine many previous lines and the first occurence of such quote ine the
current one , is a closing one.
Well I guess this is too much of a trouble for something living this way
for such
On Tue, Jun 29, 2021 at 10:23 PM L A Walsh wrote:
> I hope a basic question isn't too offtopic.
> Say I have some number of jobs running:
>
> > jobs|wc -l
> 3
> ---
>
> Would like to pass a varname to njobs to store the answer in, like:
>
> So I can run:
>
> > njobs n
> echo "$n"
> 3
>
>
This a
On Fri, Jul 2, 2021 at 9:24 AM Alex fxmbsw7 Ratchev
wrote:
> jobsn=( $( jobs -p ) ) jobsn=${jobsn[@]}
>
This give
PW$ jobsn=( $( jobs -p ) ) jobsn=${jobsn[@]}
PW$ echo $jobsn
3644 3645 3646 3647
I guess you meant jobsn=${#jobsn[@]}
^ You missed the
On Fri, Jul 2, 2021 at 11:15 AM Alex fxmbsw7 Ratchev
wrote:
> good debugging, yea i missed the n # count char, i type stupidly from a
> cell foun, ..
> and yea leftover arr ekements exceots when u just use the first one as n
> i just wanted to show shorter code
>
Yes I like those little one line
quot;Namespace collision '$1' " >&2 &&
return 1
typeset -n foo_out="$1"
foo_out="value"
}
This one reject the bad 'x[0$(date>&2)]' only accept scalar variable names
as output parameter and reject scalar in the foo() namespace.
200, Phi Debian wrote:
> > Regarding the code injection I am not sure I got it.
> >
> > If you are sitting at a prompt, why would you trick
> >
> > unicorn:~$ njobs_ref 'x[0$(date>&2)]'
> >
> > when you could simply type
> > unicorn:
I was looking at a bug on ksh93 that is
"core dumps doing glob pattern on long string" and it happen that bash
suffer the same.
$ [[ $(printf '%010d' 0) == +(0) ]]
I see 3 way of fixing this
1) [[ string == pattern ]] is for glob pattern, so string should be
limited to PATH_MAX, so an upfro
@Oğuz A simple look at the core dump will suffice to convince you that the
stack has overflowed. As Koichi stated, both ksh and bash do implement de
'simple' recursive approach.
My question was only about the strategy that bash would follow, to converge
with bash, i.e we can still both core dump,
Ok, I agry that PATH_MAX should not be considered, because not defined
every where (OS's)
If you decide a limit let me know I would use the same for ksh93 :)
for the time being we core dump :)
Cheers.
On Mon, Oct 10, 2022 at 9:08 PM Chet Ramey wrote:
> That's not the point. The point is that shell pattern matching is used in
> contexts other than filename globbing, and the shell shouldn't broadly
> impose a filename-only restriction on those uses.
>
> Chet
>
Ok got it, I was confused because
On Tue, Oct 11, 2022 at 7:23 AM Martin D Kealey
wrote:
>
> 4) compile globs into state machines, the same way that regexes get
> compiled, so that they can be matched without needing any recursion.
>
> -Martin
>
Do you mean the NFA colud trade recursion for malloc()'d backtracking point
record?
Hum, may be I was over optimistic regarding alloca(), it seems it core
dumps as well :-), i.e never return NULL.
I was mentioning alloca() because I use to do my own stacksize check using
getrlimit() and getting the max stack size, and measuring the distance
between the stack_base and the recursio
iner ==> infer sorry about typo's
On Tue, Oct 11, 2022 at 9:02 AM Martin D Kealey
wrote:
> Broadly I meant translating into a "preferably" Deterministic
> (stackless/non-backtracking) Finite State Automaton.
>
> However I note that it's not always possible to make a Deterministic FSA
> when you have repeatable groups which themse
On Wed, May 17, 2023 at 12:21 PM Oğuz İsmail Uysal <
oguzismailuy...@gmail.com> wrote:
>
> This boils down to the following
>
> true &
> false &
> wait -n
>
> There is no guarantee that `wait -n' will report the status of `true',
> the shell may acquire the status of `false' first.
Strange, on BASH_VERSION='5.1.16(1)-release' sleep don't get interupted by
SIGWINCH
┌─none:/home/phi
└─PW$ trap 'echo $LINES.$COLUMNS' SIGWINCH
┌─none:/home/phi # Resizing window here
└─PW$ 79.80
└─PW$ 78.80
└─PW$ 77.80
└─PW$ 76.80
└─PW$ 75.80
^C
┌─none:/home/phi
└─PW$
Well
┌─none:/home/phi
└─PW$ type sleep
sleep is hashed (/usr/bin/sleep)
So sleep is not a builtin here.
On Thu, Jul 20, 2023 at 3:28 PM Greg Wooledge wrote:
>
> The idea that this would "work" is quite surprising to me. The basic
> idea of a function is that it does stuff and then returns you to the
> point where you were when the function was called.
>
>
Really ?
> In other languages, would you
I find it usefull and keep it :-) Thanx tons.
readonly [-aAf] [-p] [name[=word] ...]
> The given names are marked readonly; the values of these
> names
> may not be changed by subsequent assignment. If the -f
> option
> is supplied, the funct
On Thu, Aug 31, 2023 at 9:11 PM Chet Ramey wrote:
>
> I doubt I'd ever remove %b, even in posix mode -- it's already been there
> for 25 years.
>
>
> Neither one is a very good choice, but `#' is the better one. It at least
> has a passing resemblence to the desired functionality.
>
> Why not sta
Well after reading yet another thread regarding libc_printf() I got to
admit that even %B is crossed out, (Yet already choosen by ksh93)
The other thread also speak about libc_printf() documentting %# as
undefined for things other than a, A, e, E, f, F, g, and G, yet the same
thread also talk abo
On Fri, Sep 1, 2023 at 8:10 PM Stephane Chazelas
wrote:
> 2023-09-01 07:54:02 -0500, Eric Blake via austin-group-l at The Open Group:
>
>
> FWIW, a "printf %b" github shell code search returns ~ 29k
> entries
> (
> https://github.com/search?q=printf+%25b+language%3AShell&type=code&l=Shell
> )
>
>
Since we are on the error path (not the perf path) may be the shell could
go the extra miles and try some more diag, has it does for shebang, on
ENOENT, the shell could try to open the a.out, if OK try some other
euristics, at least the trivial one i.e the multilib case that seems the
most disorien
On Thu, Oct 5, 2023 at 12:57 PM Greg Wooledge wrote:
> On Thu, Oct 05, 2023 at 07:04:26AM +0200, Phi Debian wrote:
> > Since we are on the error path (not the perf path) may be the shell could
> > go the extra miles and try some more diag, has it does for shebang, on
> > EN
On Wed, Oct 25, 2023 at 11:09 AM Holger Klene wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto
> -ffat-lto-objects -fstack-protector-strong -Wformat -
On Wed, Oct 25, 2023 at 5:01 PM Greg Wooledge wrote:
>
> Ahh. That wasn't clear to me. Thanks.
>
>
Ouch got caught the same way. This can be reduced to
$ clear
$ echo "\e[36;44;4m\nsome colored\ttext with\ttabs\e[m\n"
$ # Recall and run prev command
repeat the later until top lines scroll out
Confirmed on Ubuntu 22.04.3 LTS
--
$ cat ~/yo.sh
echo $BASH_VERSION
echo 0 $LINENO
if ((1)); then
( : ) | : ; echo 1 $LINENO
fi
echo 2 $LINENO
$ for s in bash ./bash ksh zsh
> do printf "\n$s\n" ; $s ~/yo.sh
> done
bash
5.1.16(1)-release
0 2
1 4
2 5
$ man bash
...
CONDITIONAL EXPRESSIONS
...
-a file
True if file exists.
-e file
True if file exists.
...
'May be' would be nice for newbies to precise which options are [ specific
vs [[ specific for instance
-a file
True if file exis
On Wed, Mar 27, 2024 at 10:28 AM Andreas Kähäri
wrote:
> On Wed, Mar 27, 2024 at 10:00:06AM +0100, Phi Debian wrote:
> > $ man bash
>
> Would it not be untrue to say that "-a" is specific to "[[", as it is
> clearly not the case? The fact that it is ea
Interestingly, the ksh docco say that 'Conditional Expressions' applies to
[[ only :-) and then say the -a is obsolete.
test expression
later says
the -a and -o binary oper-
ators can be used, but they are fraught with pitfalls due
to
grammatical ambiguities a
ll shows up as error: and then a simple make
test >out 2>&1 is enough then grep error: out
Any help appreciated.
Cheers,
Phi
h now :)
Cheers,
Phi
0x8 on
Using generate 0x7f is a flaw since ages :)
Cheers,
Phi
ource, yet
mapped ok), terminator unfortunatly don't have it :)
xterm use xresources, that what I use i.e
xmodmap backspace give 0x8
xresources VT100 Backsapce 0x08
stty erase ^H
With that I am almost an happy camper :)
Cheers,
Phi
was-called
This shows that my handler was called, on failure to find a function, it
forward to the previous handler, then it shows that it ran in the shell
contect as A= is set correfctly.
I got no memory leak detected with this patch, but again review thouroughly.
Hope this helps.
Cheers,
Phi
diff --git a/execute_cmd.c b/execute_cmd.c
index 3864986d..ef32631a 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -5370,6 +5370,20 @@ execute_disk_command (words, redirects,
command_line, pipe_in, pipe_out,
command = search_for_command (pathname, CMDSRCH_HASH|(stdpath ?
CMDSRCH_STDPATH : 0)
and in this case it should simply not be
documented in the docco, or else it should be done as specifed i.e a
function incovation is not a subshell running a function, that frankly is a
bit ridiculous.
Cheers,
Phi
tion of lazy
function autoload that works with the current implementation,
command_not_found() simply sending a signal to main shell, saying we got a
CNF :) ugly but it works.
I love bash and all the evolution of it.
Cheers,
Phi
On Fri, May 3, 2024 at 5:26 AM Koichi Murase wrote:
>
>
> By the name "import", I expect also something like an include guard,
> i.e., it loads the same file only once at most. I have a
> shell-function implementation,`ble-import', in my framework. It
> doesn't support namespace, but it supports
On Sat, May 4, 2024 at 4:44 AM Matheus Afonso Martins Moreira <
math...@matheusmoreira.com> wrote:
>
> By "library system" I just mean the exact mechanism through which
> bash will load a "library". By "library", I mean ordinary scripts
> whose purpose is to collect related functions and variables
On Sun, May 5, 2024 at 9:47 PM Greg Wooledge wrote:
> On Sun, May 05, 2024 at 03:32:04PM -0400, Lawrence Velázquez wrote:
>
>
> The idea to add a BASH_SOURCE_PATH variable that gets searched before, or
> instead of, PATH when using the source builtin -- that sounds good. I
> don't really underst
On Mon, May 6, 2024 at 5:43 AM Matheus Afonso Martins Moreira <
math...@matheusmoreira.com> wrote:
> > I think every single use of the term "library" in this whole endeavor
> > is misleading and misguided.
>
> I don't think so. A library is just a logical collection of code and data
> that you can
On Mon, May 6, 2024 at 7:28 AM Matheus Afonso Martins Moreira <
math...@matheusmoreira.com> wrote:
> Yet the feature has been described as "irritating"!
> I really don't understand the cause for this
> and it's making me feel really unwelcome.
>
I think it is not personnal, you proposed something
On Mon, May 6, 2024 at 7:51 PM Kerin Millar wrote:
>
>
> I'll put it in a little more detail, though no less plainly. I find the
> terminology of "libraries" and "modules" to be specious in the context of a
> language that has no support for namespaces, awkward scoping rules, a
> problematic impl
Ok thanx for clarification.
I agry about git{lab,hub} position that's why I added {,whatever} meaning
something really free.
Ok now all is clear and I will not be surprised anymore if some other
'feature' proposal shows up in the future.
On Sat, May 18, 2024 at 3:23 PM Matheus Afonso Martins Moreira <
math...@matheusmoreira.com> wrote:
>
> > That would cause shell scripts to see it and exhibit a change in
> behavior.
>
> Only if the -i option is not implemented.
> If it is, there will be zero change in behavior
> whether BASH_SOUR
On Sun, May 19, 2024 at 1:17 AM Matheus Afonso Martins Moreira <
math...@matheusmoreira.com> wrote:
>
> Those should continue to work without any changes.
> They should even be compatible with each other:
> there should be no problems with sourcing -i a script
> which then sources another script n
On Sun, May 19, 2024 at 10:58 AM Matheus Afonso Martins Moreira <
math...@matheusmoreira.com> wrote:
>
> This is not a problem that's introduced by this patch.
> People can already do that today. Anyone could write
> `alias source='rm -rf --no-preserve-root /*'` right now,
> nothing stops them. So
On Mon, May 20, 2024 at 7:54 PM Greg Wooledge wrote:
> On Mon, May 20, 2024 at 07:43:10PM +0200, Andreas Kähäri wrote:
> > On Mon, May 20, 2024 at 05:31:05PM +, Matheus Afonso Martins Moreira
> wrote:
> >
> > PATH=${BASH_SEARCH_PATH-$PATH} . file
> >
> > without the need to add any opti
On Tue, May 21, 2024 at 1:15 PM Greg Wooledge wrote:
> On Tue, May 21, 2024 at 10:12:55AM +, Matheus Afonso Martins Moreira
> wrote:
> > > the schizophrenic nature of the feature
> >
> > First the feature was "irritating" ... Now it's "schizophrenic" ?
> > I must be mentally ill for trying to
On Tue, May 21, 2024 at 1:17 PM Koichi Murase
wrote:
> There are already shell-function implementations at
> /examples/functions/autoload* in the Bash source. They reference FPATH
> to load functions, though one needs to call `autoload' for each
> function in advance (by e.g. `autoload "$fpath_e
@Greg, @Martin +1, lost sight of the feature, and xing fingers that current
semantic/behavior is not destroyed, @Oğuz -1 I'd like to avoid fixing
script that run today just because bash was updated or I would advocate
distros to keep a frozen bash as macos did.
mp;1||echo $PWD was unlinked)\n$ '
$ pwd
/home/phi/tmp/yo
$ ls
asd qwe rty
$ rm -rf $PWD
/home/phi/tmp/yo was unlinked
$ ls
/home/phi/tmp/yo was unlinked
$ cd ..
$ mkdir -p yo/asd ; >yo/qwe >yo/rty ; cd yo
$ pwd
/home/phi/tmp/yo
=
Bottom
>From /dev/pts/0
===
┌─none /home/phi
└─PW$ : < <(cat)
┌─none /home/phi
└─PW$
>From /dev/pts/1
===
┌─none /home/phi
└─PW$ psg cat
phi21786 21181 0 12:17 pts/000:00:00 cat
┌─none /home/phi
└─PW$ psg cat
phi21786 21181 0 12:17 pts/0
On Sat, Feb 8, 2025 at 8:51 AM Robert Elz wrote:
>
> There are a gazillion different ways of getting rid of the octal
> conversion "problem", one I prefer in cases where I know the value
> is 2 digits, always, but might be 0n for 0<=n<=9, is $(( 1$x - 100 ))
>
> kre
>
>
gazillion++
You say "I k
On Mon, Feb 10, 2025 at 1:15 PM Greg Wooledge wrote:
Ha now we introduce signed (not obvious from original post)
> The following line noise is the best *general* answer we've found
> so far:
>
> $((${num%%[!+-]*}10#${num#[-+]}))
If 'best *general*' refer to the shortest line noise does
$
On Mon, Feb 10, 2025 at 6:44 PM Greg Wooledge wrote:
>
>
> No, I've shown that it *is* working in older versions of bash, and I'm
> asking *why*.
>
> As far as I can tell by reading the CHANGES file, it shouldn't work.
>
> But it does.
>
Jeez, sorry about that, my 'fast reading' parser skipped t
On Mon, Feb 10, 2025 at 3:43 PM Greg Wooledge wrote:
>
> Can you please explain *how* this is working in older bash versions?
>
I forgot to mention 'best on modern bash' :-),
as well as you forgot to mention
'The following line noise is the best *general* answer we've found
so far: with dyno ba
On Mon, Feb 10, 2025 at 5:48 PM Chet Ramey wrote:
>
> There isn't a reward for brevity or obfuscation; say what you mean:
>
> isnum2()
> {
> case "$1" in
> [-+] | '') return 1;; # empty or bare `-' or `+'
> [-+]*[!0-9]*) return 1;; # non-digit with leading
On Mon, Feb 10, 2025 at 7:06 PM Andreas Schwab wrote:
> On Feb 10 2025, Greg Wooledge wrote:
>
> > No, I've shown that it *is* working in older versions of bash, and I'm
> > asking *why*.
>
> Does it? If it did, it should have printed -23, not -19.
>
> --
> Andreas Schwab, SUSE Labs, sch...@suse
On Mon, Feb 10, 2025 at 5:34 PM Zachary Santer wrote:
>
> int_regex='([+-]?)0*([[:digit:]]+)'
> if [[ ${var} =~ ${int_regex} ]]; then
> var="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
> else
> printf '%s\n' "Argument '${var}' is not a valid integer" >&2
> fi
>
The error message should be 'not a v
I still don't know the impact (implication) of extdebug, does it impact
perf ?
It was not obvious from the reading that it would work when trap is inside
the function but that is exactly what I need.
Again, may be it is just me, but the reading with the back and forth
reading and long distance jump in the docco to figure out how it works
looks complicated, but that's good en
On Mon, Feb 10, 2025 at 5:48 PM Chet Ramey wrote
>
> There isn't a reward for brevity or obfuscation; say what you mean:
>
> isnum2()
> {
> case "$1" in
> [-+] | '') return 1;; # empty or bare `-' or `+'
> [-+]*[!0-9]*) return 1;; # non-digit with leading
I admit the function was mis-named, should be isanumexpr
As @chet noted this attempt was not too bad just need a little $1 check
before pursuing the idea of letting the bash scanner do the job for
complicated valid number (any base)
I come up with this one
function isanum
{ [[ "$1" =~ ^[+-]?[0-9
On Mon, Feb 10, 2025 at 11:10 PM Greg Wooledge wrote:
>
> hobbit:~$ phi 029
> bash: ((: 029: value too great for base (error token is "029")
> bash: ((: 029: value too great for base (error token is "029")
>
> So we come full circle.
>
Nope phi() is not
On Mon, Feb 10, 2025 at 11:46 PM microsuxx wrote:
> a bit unrelated .. cheap numbers filter ..
>
> gimme_num( ) { declare -n b=BASH_REMATCH\[1] ; local o m=[0-9,.] s=$n i t ;
> t="(-?$m+)" ; unset -v o ; for n ; do unset -v i ; while [[ $n =~ $t ]] ;
> do n=${n/"$b"} i= o+=$b$s ; done ; [[ -v i ]
Can follow that fast, the n-1 version gives
gimme_num( ) { local y o m='[0-9,.]' s=$'\n' i t ; t="(-?$m+)" ; unset -v o
; for n ; do unset -v i ; while [[ $n =~ $t ]] ; do y=${BASH_REMATCH[1]}
n=${n/"$y"} i= o+=$y$s ; done ; [[ -v i ]] && o+=$s ; done ; [[ -v o ]] &&
printf %s "$o" ; }
$ gimme_num
On Tue, Feb 11, 2025 at 9:37 AM microsuxx wrote:
> how does it output strings .. ?
> i mean i dont get ur outputs
> 1 it doesnt include # and @ etc
> 2 no hex etc yet , only numbers and dots / commas
>
> gimme_num 0x10 60#yo 0x10
> 0
> 10
>
> 60
>
> 0
> 10
>
> but i dont get ur outputs such as 0x
On Tue, Dec 10, 2024 at 10:42 AM Mike Jonkmans wrote:
> On Tue, Dec 10, 2024 at 09:28:31AM +0100, Ulrich Müller wrote:
> > > On Mon, 09 Dec 2024, Mike Jonkmans wrote:
> >
> > >> Why is `if false; then :; fi' not a pipeline? It is a command, and
> the
> > >> components of a pipeline are comma
On Sat, Jan 25, 2025 at 4:06 PM Andreas Kähäri
wrote:
>
> Sorry, I pressed send too quickly. I was going to suggest an alternative
> to using a command substitution and tr:
>
> printf -v foo '%*s' 80 ' '
> echo "${foo// /*}"
>
> --
> Andreas (Kusalananda) Kähäri
> Uppsala, Sweden
On Thu, Feb 13, 2025 at 6:18 AM Oğuz wrote:
>
>
> Changes made to built-in printf have to be adopted by GNU printf, otherwise
> the user will have two flavors of printf on the same system by the same
> name.
> --
> Oğuz
>
You sure about the adopted by GNU printf assertion ?
$ /usr/bin/printf '%
On Thu, Feb 13, 2025 at 10:27 AM Oğuz wrote:
> And yes, I am sure; if built-in printf and GNU printf differ in common use
> cases that's a clear bug from the user's perspective.
>
There must be a bug somewhere then :-)
$ printf 1 2 3 4
1
$ /bin/printf 1 2 3 4
1/bin/printf: warning: ignoring ex
Hi,
My personal vote is for no printf warning on bad format of %fmt args, but
other may argue against that. This is no big deal because I can always do
in my scripts
alias printf='printf 2>/dev/null'
That being said if warnings are printed I suppose they must be accurate ?
I don't really get thi
On Sat, Feb 8, 2025 at 10:31 AM Robert Elz wrote:
>
>
> It isn't a valid form for a C constant.bash allows that kind of thing
> in its arithmetic contexts, but this is not one.
>
>
Jeez moving target, thanks to bring C in the loop I got it now :-) I like
this orthogonality :-)
$ printf '%d\n
On Fri, Feb 21, 2025 at 3:08 PM Chet Ramey wrote:
> On 2/20/25 11:44 PM, Phi Debian wrote:
> >
> >
> > On Thu, Feb 20, 2025 at 11:41 PM Chet Ramey > <mailto:chet.ra...@case.edu>> wrote:
> >
> > A response to the question about printf supporting %
On Thu, Feb 20, 2025 at 11:41 PM Chet Ramey wrote:
> A response to the question about printf supporting %n$ conversion
> specifications I posted to savannah.
>
Thanx @chet, I didn't knew this thread. The thread say ksh93 is buggy,
that's not what I observe with latest patches, but at time of the
On Sat, Feb 22, 2025 at 1:54 AM Robert Elz wrote:
>
>
> That is, in the example
>
> printf '%s %3$s %s\n' A B C D
>
> The updated ksh93 seems to ignore the numbered conversions when counting
> the args for the unnumbered ones (so "A C B" (for the first line anyway,
> I won't go on about r
On Sun, Feb 23, 2025 at 12:34 AM Robert Elz wrote:
> Date:Sat, 22 Feb 2025 09:48:29 +0100
> From:Andreas Schwab
> Message-ID: <87r03q5pr6@linux-m68k.org>
>
> | On Feb 22 2025, Phi Debian wrote:
> | > I forgot to mention your trick
On Fri, Feb 21, 2025 at 8:52 PM Chet Ramey wrote:
> On 2/21/25 1:37 PM, Phi Debian wrote:
> >
>
> I got that behavior with Version AJM 93u+m/1.1.0-alpha 2022-07-31.
>
> I just updated my version using macports and I get the same behavior as
> you with Version AJM 93u+m/
On Sat, Feb 22, 2025 at 9:49 AM Andreas Schwab
wrote:
> On Feb 22 2025, Phi Debian wrote:
>
> > I forgot to mention your trick to nuke the fmt reuse still works
> >
> > $ printf '%s %s %s %999$s' A B C D E F G
> > A B C
>
> As long as NL_ARGMA
May be some orthogonality regarding %d expecting a string vs num-expr
$ a=1234 i=1
$ echo ${a:i+1}
34
$ echo ${a:$((i+1))}
34
$
Why do we have this 'offset' evaluated, you could use the same argument you
used for printf that is $((...)) is good enough, add clarity, remove
ambiguity and the docco
On Mon, Feb 24, 2025 at 8:22 AM Martin D Kealey
wrote:
>
>
> On Mon, 24 Feb 2025 at 13:48, Phi Debian wrote:
>
>> I also forgot to mention that C99 introduced this
>>
>>There may be no gaps
>>in the numbers of arguments specified
On Mon, Feb 24, 2025 at 4:14 PM Chet Ramey wrote:
>
> >
> > The beast of burden is already done in bash, it does scan the fmt string
> > recognise integer conversion specifier fetch the arg 'string' and apply
> an
> > integer validity test on it, this is on this last operation that the
> > validi
On Sun, Feb 23, 2025 at 8:03 PM Chet Ramey wrote:
> On 2/22/25 12:38 AM, Phi Debian wrote:
>
> > The new semantic is simple
> > - numbered are indexed args access (easy to understand)
> > - unumbered are counting only the unumbered from the fmt string
> >
> >
On Mon, Mar 10, 2025 at 5:39 PM Zachary Santer wrote:
>
> Another alternative would be for bash to print a warning whenever it
> encounters this syntax.
>
Don't do that, the one who don't care about shell portability. i.e the
script started with #!/bin/bash may well be using this construct "for
94 matches
Mail list logo