building 5.1.3 -- some probs...

2021-02-22 Thread L A Walsh
I'm trying to build bash 5.1.3, and at first I tried w/bash-malloc, but got: /bash-5.1> ./bash malloc: subst.c:4751: assertion botched free: called with unallocated block argument Aborting...Aborted (core dumped) --- Another prob which seems a bit odd -- more than once, on the first time after a

Re: building 5.1.3 -- some probs...

2021-02-22 Thread L A Walsh
(Doi!) Forgot it was executing initial rc scripts. Turned on -x since last statement seems pretty mundane. Also 6 statements after where it claimed it crashed, is a custom function for printing pwd for the prompt. I've tried with different compile ops (optim vs. dbg). with builtin readline and in

Re: building 5.1.3 -- some probs...

2021-02-24 Thread L A Walsh
On 2021/02/23 14:10, Chet Ramey wrote: On 2/22/21 10:09 PM, L A Walsh wrote: export _home_prefix=${HOME%/*}/ I can't reproduce it, though I'm sure this is the line where it crashes for you. What is HOME set to? HOME=/home/law so _home_prefix will be '/home

Re: is it normal that set -x unset commands dont display special chars in the content

2021-02-28 Thread L A Walsh
On 2021/02/28 14:13, Chet Ramey wrote: On 2/27/21 6:14 AM, Alex fxmbsw7 Ratchev wrote: These code fragments have nothing to do with each other. Why not include a self-contained example that includes relevant `stuff' in what you're passing to `unset'? cuz he's trollin us?

Re: Changing the way bash expands associative array subscripts

2021-03-15 Thread L A Walsh
On 2021/03/15 17:12, Chet Ramey wrote: I'm kicking around a change This means that, given the following script, declare -A a key='$(echo foo)' a[$key]=1 a['$key']=2 a["foo"]=3 What do folks think? --- Looks like a flexible way to deal with some of the side effects of the double-dequotin

Wanted: quoted param expansion that expands to nothing if no params

2021-03-23 Thread L A Walsh
Too often I end up having to write something like if (($#)); then "$@" else # = function or executable call fi It would be nice to have a expansion that preserves arg boundaries but that expands to nothing when there are 0 parameters (because whatever gets called still sees "" as a paramet

Re: Wanted: quoted param expansion that expands to nothing if no params

2021-03-24 Thread L A Walsh
On 2021/03/23 21:41, Lawrence Velázquez wrote: On Mar 23, 2021, at 11:43 PM, Eli Schwartz wrote: It's not clear to me, how you expect this to differ from the existing behavior of "$@" or "${arr[@]}" which already expands to rather than an actual "" parameter. The original message do

Re: Default PS1

2021-03-29 Thread L A Walsh
On 2021/03/29 04:04, ილია ჩაჩანიძე wrote: How can I set default PS1 variable from source code? --- What do you mean "from source code?" E.g I want it to display: My-linux-distro $ And not: Bash-5.1 $ --- Does the procedure documented in the bash man page not work? Or, what do you me

Re: zsh style associative array assignment bug

2021-03-29 Thread L A Walsh
On 2021/03/28 11:02, Eric Cook wrote: On 3/28/21 7:02 AM, Oğuz wrote: As it should be. `[bar]' doesn't qualify as an assignment without an equals sign, the shell thinks you're mixing two forms of associative array assignment there. In the new form, that a key is listed inside a compound as

Re: Default PS1

2021-03-29 Thread L A Walsh
On 2021/03/29 14:39, Greg Wooledge wrote: On Mon, Mar 29, 2021 at 01:49:41PM -0700, L A Walsh wrote: Or, what do you mean by 'default'? Is it sufficient to set it in the system /etc/profile so it is the default for all users when logging in? Sadly, that won't work. T

Re: Defaults -- any

2021-03-30 Thread L A Walsh
On 2021/03/29 20:04, Greg Wooledge wrote: On Mon, Mar 29, 2021 at 07:25:53PM -0700, L A Walsh wrote: I have both /etc/profile and /etc/bashrc call my configuration scripts. Are there common paths that don't call one of those? A vanilla bash compiled from GNU sources wi

Re: SIGCHLD traps shouldn't recurse

2021-04-05 Thread L A Walsh
On 2021/04/03 00:41, Oğuz wrote: but I don't think it's useful at all because the number of pending traps keeps piling up, and there is no way to reset that number. If there is no real use case for recursive SIGCHLD traps (which I can't think of any), I think this should change; no SIGCHLD trap

Re: SIGCHLD traps shouldn't recurse

2021-04-06 Thread L A Walsh
On 2021/04/06 00:23, Oğuz wrote: 5 Nisan 2021 Pazartesi tarihinde L A Walsh <mailto:b...@tlinx.org>> yazdı: On 2021/04/03 00:41, Oğuz wrote: but I don't think it's useful at all because the number of pending traps keeps piling up, and

Re: incorrect character handling

2021-04-06 Thread L A Walsh
On 2021/03/30 13:54, Lawrence Velázquez wrote: Further reading: https://mywiki.wooledge.org/BashPitfalls#echo_.22Hello_World.21.22 --- I find that disabling history expansion via '!' at bash-build time is the most ideal solution, since someone preferring 'csh' would likely still be using c

Re: Changing the way bash expands associative array subscripts

2021-04-13 Thread L A Walsh
On 2021/04/06 08:52, Greg Wooledge wrote: In that case, I have no qualms about proposing that unset 'a[@]' and unset 'a[*]' be changed to remove only the array element whose key is '@' or '*', respectively, and screw backward compatibility. The current behavior is pointless and is nothing but a

RFE - support option for curses idea of term size.

2021-04-26 Thread L A Walsh
I'm not clear if termcap lib has this or not, when the curses library is in use, it supports the idea of reading and setting the term size. Users can set this with the 'tabs' program included in the curses package. Besides supporting X/Open standards for tabs for some specific languages, it als

Re: RFE - support option for curses idea of term [tab]size.

2021-04-29 Thread L A Walsh
On 2021/04/26 17:16, Chet Ramey wrote: On 4/26/21 7:19 PM, L A Walsh wrote: I'm not clear if termcap lib has this or not, when the curses library is in use, it supports the idea of reading and setting the term [tab]size. Can't you do this with `stty size' already? Setting

Re: Prefer non-gender specific pronouns

2021-06-05 Thread L A Walsh
On 2021/06/05 08:35, Oğuz wrote: 5 Haziran 2021 Cumartesi tarihinde Vipul Kumar < kumar+bug-b...@onenetbeyond.org> yazdı: Hi, Isn't it a good idea to prefer non-gender specific pronoun (like "their" instead of "his") at following places in the reference manual? No it's not.

Re: Prefer non-gender specific pronouns

2021-06-07 Thread L A Walsh
On 2021/06/06 07:19, Alain D D Williams wrote: The important thing is that there is no intention to oppress/denigrate/... But it does _suggest_ that the default user is a male. or, speaking about historical use, that the default user was male. The problem comes when someone reads gendered langu

Re: Prefer non-gender specific pronouns

2021-06-07 Thread L A Walsh
On 2021/06/06 04:48, Léa Gris wrote: Le 06/06/2021 à 11:33, Ilkka Virta écrivait : In fact, that generic 'they' is so common and accepted, that you just used it yourself in the part I quoted above. Either you're acting in bad faith, or you're so confused by your gender-neutral delusion that

simple prob?

2021-06-29 Thread L A Walsh
I hope a basic question isn't too offtopic. Say I have some number of jobs running: jobs|wc -l 3 --- in a function (have tried shopt -s/-u lastpipe; neither way worked) njobs() { jobs |wc -l } njobs 3 Would like to pass a varname to njobs to store the answer in, like: njobs() { jobs|wc -l

Re: simple prob?

2021-06-29 Thread L A Walsh
On 2021/06/29 13:35, Eli Schwartz wrote: Well, if you don't think this is a bug in bash, but something you need help figuring out, maybe you'd prefer to use the "help-bash" list? Actually - The original message was received at Tue, 29 Jun 2021 13:06:34 -0700 The following

Re: simple prob?

2021-06-29 Thread L A Walsh
On 2021/06/29 13:35, Greg Wooledge wrote: unicorn:~$ njobs() { local _n=$(jobs | wc -l); eval "$1=\$_n"; } --- ARG...I thought about that and rejected it because I thought the "jobs|wc-l" would be in a sub-shell and not pickup the background jobs! Double arg, this works as well: sjobs() { lo

Re: simple prob?

2021-06-29 Thread L A Walsh
On 2021/06/29 14:02, Greg Wooledge wrote: declare, printf -v, local -n, eval -- they're mostly equivalent. Some of them may prevent *some* possible code injections, but none of them prevent *all* possible code injections. unicorn:~$ njobs2() { printf -v "$1" %s 42; } unicorn:~$ njobs2 'x[0$(date

Re: simple prob?

2021-06-29 Thread L A Walsh
On 2021/06/29 15:49, Greg Wooledge wrote: On Tue, Jun 29, 2021 at 02:58:28PM -0700, L A Walsh wrote: njobs() { printf ${1:+-v $1} "%s\n" "$(jobs |wc -l)"; } Using that with your input: njobs 'x[0$(date >&2)]' bash: printf: `x[0$(date': not a v

Re: simple prob?

2021-06-29 Thread L A Walsh
On 2021/06/29 16:51, Greg Wooledge wrote: On Tue, Jun 29, 2021 at 04:29:05PM -0700, L A Walsh wrote: njobs() { printf ${1:+-v $1} "%s\n" "$(jobs |wc -l)"; } Which is detected as "illegal input" and disallowed. If you don't enable som

Re: simple prob made into a security tragedy...oh well.... ;^/

2021-07-01 Thread L A Walsh
On 2021/06/29 19:11, Eli Schwartz wrote: This is a ridiculous argument and you know it. You, personally, are writing code which does not get used in security contexts, which is your right. This in no way means that refusing to quote variables which "cannot be word-split" stops *any* security err

should bashdb be included w/bash?

2021-07-24 Thread L A Walsh
Not entirely sure how, but have been running 5.1.8(3)-release which seems fine...up until I wanted to single step a script... bashdb ...and saw /usr/share/bashdb/command/set_sub/dollar0.sh: line 23: enable: dynamic loading not available (/tmp/rearrange_files.sh:4): 4: shopt -s expand_aliases ba

Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread L A Walsh
On 2021/08/17 04:02, Osipov, Michael (LDA IT PLM) wrote: Folks, this is basically the same issue as I reported in readline: https://lists.gnu.org/archive/html/bug-readline/2021-08/msg0.html The bad hunk seems not to be POSIX shell compliant. I think your eyes are fooling you. I looke

Re: An alias named `done` breaks for loops

2021-08-17 Thread L A Walsh
On 2021/08/14 17:05, Kerin Millar wrote: On Sat, 14 Aug 2021 15:59:38 -0700 George Nachman wrote: This does not constitute a valid test case for two reasons. Firstly, aliases have no effect in scripts unless the expand_aliases shell option is set. 1) I frequently use for loops in

use-cases promote thinking of limited application

2021-08-22 Thread L A Walsh
On 2021/08/19 02:15, Ilkka Virta wrote: $ declare -A A=([foo bar]="123 456" [adsf]="456 789") $ printf "<%s>\n" "${A[@]@K}" Interesting. I wonder, what's the intended use-case for this? --- Does it matter?: Organizing data. In this case, the data may be organized by pairs. If you have a l

Re: use-cases promote thinking of limited application

2021-08-22 Thread L A Walsh
On 2021/08/22 19:14, Koichi Murase wrote: I'd guess Ilkka has asked the use case for this particular output format, i.e., the quoted fields inside a single word. If the purpose is organizing the data, I would naturally expect the result in the following more useful format in separate words wi

efficient way to use matched string in variable substitution

2021-08-23 Thread L A Walsh
Starting with a number N, is there an easy way to print its digits into an array? I came up with a few ways, but thought this would be nice (with '\1' or '$1' being what was matched in the 1st part), this could be statement: arr=(${N//[0-9]/\1 }) or arr=(${N//[0-9]/$1 }) Instead of using loops

Re: efficient way to use matched string in variable substitution

2021-08-23 Thread L A Walsh
On 2021/08/23 12:10, Greg Wooledge wrote: On Mon, Aug 23, 2021 at 11:36:52AM -0700, L A Walsh wrote: Starting with a number N, is there an easy way to print its digits into an array? "Easy"? Or "efficient"? Your subject header says one, but your body says the

Re: efficient way to use matched string in variable substitution

2021-08-24 Thread L A Walsh
On 2021/08/24 05:06, Greg Wooledge wrote: Looks like the efficiency of "read -ra" vs. a shell loop just about makes up for the system calls used for the here string (f6 and f7 are almost tied in overall speed, with f6 just a *tiny* bit faster). Good to know. If you set your TIMEFORM

Re: LINENO is affected by where it is

2021-09-04 Thread L A Walsh
On 2021/09/01 02:36, David Collier wrote: Version: GNU bash, version 5.0.3(1)-release (arm-unknown-linux-gnueabihf) Raspberry Pi using Raspbian. Installed from repo? LINENO goes backwards when run sync LINENO isn't the number of lines executed, but is the linenumber in the source f

?maybe? RFE?... read -h ?

2021-09-04 Thread L A Walsh
I know how -h can detect a symlink, but I was wondering, is there a way for bash to know where the symlink points (without using an external program)? Like if I'm running a script and check if something is a symlink to a dir that isn't there, is there a way to read the value of a symlink like a "

Re: ?maybe? RFE?... read -h ?

2021-09-06 Thread L A Walsh
On 2021/09/05 20:54, Lawrence Velázquez wrote: On Sun, Sep 5, 2021, at 11:11 PM, Dale R. Worley wrote: L A Walsh writes: I know how -h can detect a symlink, but I was wondering, is there a way for bash to know where the symlink points (without using an external program)? My

Re: Incorrect LINENO with exported nested functions with loops

2021-10-06 Thread L A Walsh
On 2021/10/05 16:25, Tom Coleman wrote Repeat-By: Below is a sample script to replicate the bug in LINENO. --- 1st prob: scrip doesn't work as is. /tmp/lnno /tmp/lnno: line 23: syntax error near unexpected token `done' /tmp/lnno: line 23: ` done' added the line numbers inde

Re: Arbitrary command execution in shell - by design!

2021-10-29 Thread L A Walsh
On 2021/10/29 05:01, Greg Wooledge wrote: On Fri, Oct 29, 2021 at 12:48:57PM +0300, Ilkka Virta wrote: Not that I'm sure the upper one is still safe against every input. I think issues with associative array keys have been discussed on the list before. Sadly, yes. Bash is the explo

Re: Arbitrary command execution in shell - by design!

2021-10-29 Thread L A Walsh
On 2021/10/29 12:33, Greg Wooledge wrote: On Fri, Oct 29, 2021 at 11:59:02AM -0700, L A Walsh wrote: How much lameness Chet has introduced into bash to accommodate the wrong users. This is quite unfair. Huh? It's true--look at how functions have to be stored in the enviro

Re: Why should `break' and `continue' in functions not break loops running outside of the function?

2021-10-30 Thread L A Walsh
On 2021/10/30 09:07, Robert Elz wrote: oguzismailuy...@gmail.com said: | `break' is not a keyword in the shell, but a special command. That's true. However, 99%**1 of script writers don't see it that way,g they believe it is just like "if" or "while" or "done" or "return". That's why

Re: Zero-length indexed arrays

2021-12-22 Thread L A Walsh
On 2021/12/21 20:07, Greg Wooledge wrote: On Tue, Dec 21, 2021 at 10:48:07PM -0500, Dale R. Worley wrote: Lawrence Vel�zquez writes: Did you mean to say that ${#FOO[*]} causes an error? Because ${FOO[*]} does not, a la $*: The case that matters for me is the Bash that shi

Re: bash conditional expressions

2021-12-25 Thread L A Walsh
On 2021/11/12 01:36, Mischa Baars wrote: Hi All, All of my makefiles only compile source files and link object files that are NEW, as in the modification timestamp is newer than OR EQUAL TO the access timestamp, such that when I include a new source file into a project or produce a new object fi

Re: Bash not escaping escape sequences in directory names

2022-01-20 Thread L A Walsh
On 2022/01/18 22:31, Alex fxmbsw7 Ratchev wrote Fix: Haven't looked deeply into the bash internals but sanitizing the directory name (along with other user-controlled substitutions in the prompt) should work. Sanitizing? What's that? Especially in a way that won't break existing legal usage

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread L A Walsh
On 2022/01/20 22:20, Lawrence Velázquez wrote: On Fri, Jan 21, 2022, at 12:22 AM, L A Walsh wrote: On 2022/01/18 22:31, Alex fxmbsw7 Ratchev wrote Fix: [sanitizing the prompt]. Sanitizing? What's that? Especially in a way that won't break existing le

Re: Bash not escaping escape sequences in directory names

2022-01-26 Thread L A Walsh
On 2022/01/22 12:48, Andreas Kusalananda Kähäri wrote: The shell even keeps the PS1 variable's value from its inherited environment without sanitizing it. This is a requirement of the unix/posix model that has 'fork' create a new process that is a new unfiltered, unsanitized copy of

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/01/31 20:40, Martijn Dekker wrote: On the latest code from the devel branch: GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) Reproducer script: shopt -s expand_aliases alias let='let --' set -x let '1 == 1' : $(let '1 == 1') Output: + let -- '1 == 1' ++ let -- -- '1 == 1'

How to display parameters in a function backtrace?

2022-02-02 Thread L A Walsh
I was trying to find parameters to a function that gave an error, so I 'turned on' (included my backtracing routine), which showed: ./24bc: line 46: printf: `txt=\nRed,': not a valid identifier STOPPING execution @ "printf ${_:+-v $_} '\x1b[48;2;%s;%s;%sm' $1 $2 $3" in "setBgColor()" at ./24bc #

Re: Bash not escaping escape sequences in directory names

2022-02-02 Thread L A Walsh
BTW, thinking about how this problem would arise On 2022/01/20 22:43, Lawrence Velázquez wrote: Depends what you consider to be an issue. Personally, I would be less than pleased if my whole terminal turned red just because I changed into a directory that happened to have a weird name. S

Re: How to display parameters in a function backtrace?

2022-02-02 Thread L A Walsh
On 2022/02/02 06:43, Alex fxmbsw7 Ratchev wrote: i had gdb new version --- This is about looking at a backtrace of shell functions in shell gdb may show a backtrace of shell functions, but gdb isn't a shell debugger, but one for the source code of bash. If you look at my backtrace function

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/02/01 07:50, Chet Ramey wrote: "Historically some shells used simple parenthesis counting to find the terminating ')' and therefore did not account for aliases. However, such shells never conformed to POSIX, which has always required recursive parsing (see XCU 2.3 item 5)."

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/02/02 08:50, Chet Ramey wrote: On 2/2/22 8:25 AM, L A Walsh wrote: I.e. My bash is posix compliant by default w/r/t aliases: It's not, and that's how this whole issue got started. You're running bash-4.4. POSIX requires the following to work: alias s

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread L A Walsh
On 2022/02/03 07:02, Alex fxmbsw7 Ratchev wrote: On Thu, Feb 3, 2022, 04:20 Robert Elz <mailto:k...@munnari.oz.au>> wrote: Date:Wed, 02 Feb 2022 17:18:08 -0800 From: L A Walsh mailto:b...@tlinx.org>> Message-ID: <61fb2d50

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread L A Walsh
On 2022/02/03 11:02, Chet Ramey wrote: On 2/2/22 10:18 PM, Robert Elz wrote: Date:Wed, 02 Feb 2022 17:18:08 -0800 From:L A Walsh Message-ID: <61fb2d50.7010...@tlinx.org> | My posix non-conformance issue has to do with bash not startin

Re: Corrupted multibyte characters in command substitutions fixes may be worse than problem.

2022-02-05 Thread L A Walsh
On 2022/01/02 17:43, Frank Heckenbach wrote: Chet Ramey wrote: After all, we're talking about silent data corruption, and now I learn the bug is known for almost a year, the fix is known and still hasn't been released, not even as an official patch. If you use the number of bug repor

Re: Corrupted multibyte characters in command substitutions fixes may be worse than problem.

2022-02-06 Thread L A Walsh
On 2022/02/06 09:26, Frank Heckenbach wrote: On 2022/01/02 17:43, Frank Heckenbach wrote: Why would you? Aren't you able to assess the severity of a bug yourself? Silent data corruption is certainly one of the most severe kind of bugs ... --- That's debatable, BTW, as I was rem

Re: for loop over parameter expansion of array can miss resulted empty list

2022-03-22 Thread L A Walsh
On 2022/03/21 03:40, Alex fxmbsw7 Ratchev wrote: i solve this by shopt -s nullglob Repeat-By: Code: x=("/"); for i in "${x[@]%/}"; do echo "i is '$i'"; done Result: none Expected result: i is '' if you have nullglob set, then that is not the correct result. I used: #!/bin/bas

Re: [Bug Report] The Unexpected Behavior When Using ANSI Escape Code

2022-03-22 Thread L A Walsh
On 2022/03/20 02:20, Michaelll Lee wrote: When ``PS1’’ environment variable contains the ANSI escape codes, Bash will behavior unexpectedly when Copy&Paste the content from clipboard using Ctrl+V. This unexpected behaviour could be easily reproduced in a few steps. Reproduceable steps are: 1) $

Re: parameter expansion null check fails for arrays when [*] or [@] is used

2022-03-22 Thread L A Walsh
On 2022/03/21 05:45, Andreas Luik wrote: Description: Bash fails to correctly test for parameter to be unset or null when the parameter is an array reference [*] or [@]. Repeat-By: myvar[0]= echo "${myvar[0]:+nonnull}" -> OK echo "${myvar[*]:+nonnull}" nunnull -> not OK, because "${my

Re: for loop over parameter expansion of array can miss resulted empty list

2022-03-22 Thread L A Walsh
On 2022/03/22 13:53, L A Walsh wrote: On 2022/03/21 03:40, Alex fxmbsw7 Ratchev wrote: i solve this by shopt -s nullglob Repeat-By: Code: x=("/"); for i in "${x[@]%/}"; do echo "i is '$i'"; done Result: none Expected result: i is &

Re: for loop over parameter expansion of array can miss resulted empty list

2022-03-22 Thread L A Walsh
On 2022/03/22 14:04, Lawrence Velázquez wrote: On Tue, Mar 22, 2022, at 4:53 PM, L A Walsh wrote: On 2022/03/21 03:40, Alex fxmbsw7 Ratchev wrote: i solve this by shopt -s nullglob Repeat-By: Code: x=("/"); for i in "${x[@]%/}"; do echo "i

Re: parameter expansion null check fails for arrays when [*] or [@] is used

2022-03-23 Thread L A Walsh
On 2022/03/23 00:25, Ilkka Virta wrote: The POSIX phraseology is that "null" means the empty string. POSIX phraseology applies to the POSIX language. In 'C' char *s = NULL is not the same as char *s=""; They aren't the same at the machine level nor at the language level. In perl

Re: parameter expansion null check fails for arrays when [*] or [@] is used

2022-03-23 Thread L A Walsh
On 2022/03/23 09:49, Chet Ramey wrote: On 3/23/22 7:56 AM, Robert Elz wrote: You might not like the terminology, but it is what it is, and you don't get to arbitrarily redefine it, unless you change your name to Humpty Dumpty. Bonus points for the "Through the Looking Glass" refere

Re: Parallelization of shell scripts for 'configure' etc.

2022-06-18 Thread L A Walsh
On 2022/06/13 15:39, Paul Eggert wrote: In many Gnu projects, the 'configure' script is the biggest barrier to building because it takes s long to run. Is there some way that we could improve its performance without completely reengineering it, by improving Bash so that it can parallelize '

Re: Handling files with CRLF line ending

2022-12-06 Thread L A Walsh
On 2022/12/06 10:57, Chris Elvidge wrote: Yair, how about using the Python installed in the WSL instance. --- Oh, I wondered why Python used CRLF, but nothing else did. What version of python are you using? The Python for WSL, the python for cygwin, or the python for Windows? If you

curiosity: 'typeset -xr' vs. 'export -r'

2022-12-11 Thread L A Walsh
This is mostly a 'nit', but I noticed I had "typeset -xr" in one of my scripts to mean export+read-only and was wondering why "export -r" was disallowed (err message): bash: export: -r: invalid option export: usage: export [-fn] [name[=value] ...] or export -p This seems to be an unnec

Re: curiosity: 'typeset -xr' vs. 'export -r'

2022-12-12 Thread L A Walsh
On 2022/12/11 20:47, Lawrence Velázquez wrote: This happens because "declare"/"typeset" creates local variables within functions. Using -g works around this... $ Export() { declare -gx "$@"; } $ Export -r foo=1 $ declare -p foo declare -rx foo="1" ...but now

missing emails posted to list

2023-03-27 Thread L A Walsh
This is mostly a test to see if this makes it through to the list. Something else I tried to post recently never showed up, and I didn't get back an error message. Also didn't show in bash list archives. Subject line of missing email: Why difference between interactive+script doing same thin

why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
Don't know that this is a bug -- there maybe some reason why there's a difference in interactive vs. script execution...certainly isn't helpful in trying to develop a script though. I'm trying to develop a script to help me run commands on a remote system. Seems obvious -- it is ssh based, but

why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
Don't know that this is a bug -- there is likely some reason why there's a difference in interactive vs. script execution. Certainly is annoying! I'm trying to develop a script to help me run commands on a remote system. Seems obvious -- it is ssh based, but for me ssh generates 1 warning mess

why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
Don't know that this is a bug -- there is likely some reason why there's a difference in interactive vs. script execution. Certainly is annoying! I'm trying to develop a script to help me run commands on a remote system. Seems obvious -- it is ssh based, but for me ssh generates 1 warning mess

why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
Don't know that this is a bug -- there maybe some reason why there's a difference in interactive vs. script execution...certainly isn't helpful in trying to develop a script though. I'm trying to develop a script to help me run commands on a remote system. Seems obvious -- it is ssh based, but

why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
Don't know that this is a bug -- there is likely some reason why there's a difference in interactive vs. script execution. Certainly is annoying! I'm trying to develop a script to help me run commands on a remote system. Seems obvious -- it is ssh based, but for me ssh generates 1 warning mess

[sorry for dups] Re: why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
On 2023/03/27 12:39, Greg Wooledge wrote: You aren't showing the actual commands that the script is running, so we have no way to verify that whatever the script is doing is identical to what you were doing interactively. Also: readarray output< <(ssh -n -T "$user@$host" "$@" 2>&1)

oh, there they are! :-( (was: Re: missing emails posted to list)

2023-03-27 Thread L A Walsh
On 2023/03/26 10:40, L A Walsh wrote: This is mostly a test to see if this makes it through to the list. Something else I tried to post recently never showed up, and ... ... (sigh) All showed up at once, once the config was fixed...*sigh*

Re: [sorry for dups] Re: why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
On 2023/03/27 13:28, Greg Wooledge wrote: On Mon, Mar 27, 2023 at 01:05:33PM -0700, L A Walsh wrote: filter_ssh() { ign0='ssh: connect to host \w+ port 22: Connection refused' ign1='(agent returned different signature type ssh-rsa)' ign2='(ssh_exch

Re: [sorry for dups] Re: why difference between interactive+script doing same thing?

2023-03-27 Thread L A Walsh
On 2023/03/27 13:05, L A Walsh wrote: That "$@" is not going to work the way you want it to in the general case. --- While I got rid of $@ in some test versions, it was back in in later version, so that may be the main flaw at this point. Will need time to clean this mess up...

Re: [sorry for dups] Re: why difference between interactive+script doing same thing?

2023-03-28 Thread L A Walsh
On 2023/03/27 16:52, Greg Wooledge wrote: Each function has its own private set of positional parameters ("$@" array) independent of the main script's "$@". If you want the funtion to see a copy of the script's arguments, you need to pass "$@" to it. --- Yeah, forgot that. Fact was in area

Re: With DEBUG trap, resizing window crashes script

2023-05-25 Thread L A Walsh
On 2023/05/10 13:13, Eduardo Bustamante wrote: If you wish for the current shell to continue running after a terminal resize, then set the signal disposition for SIGWINCH to ignore. --- You can also display the new size: alias my=declare showsize () {\ my s=$(stty size); s="(${s// /x})" ;

problem in cd in bash (maybe an RFE);

2017-07-17 Thread L A Walsh
In Bash Ver 4.4.5, cdspell is confused by non-directory items in the same dir. uname -a Linux Ishtar 4.10.8-Isht-Van #4 SMP PREEMPT Thu Apr 20 10:46:50 PDT 2017 x86_64 GNU/Linux set -o|grep on|sed -r 's/[ ].*$//'|tr "\n" " " # (set -o "on" vals) braceexpand hashall history interac

Re: problem in cd in bash (maybe an RFE);

2017-07-24 Thread L A Walsh
Chet Ramey wrote: I can't reproduce this; I think you'd probably get different results if you turned off programmable completion. tested with: shopt -u progcomp "Problem" no longer reproducible. Seems some completion "stuff" (pkg, orphan or distro change) seems to be at fault. Than

Re: Performance issue of find function in Gluster File System

2017-08-16 Thread L A Walsh
Zhao Li wrote: So I am wondering what C code you use for "ls" and "find" and how you explain "*" in "ls" and "find" to lead to this big difference in Gluster File System. --- Nothing to do with Gluster, bash, ls or find, but w/the example. I did both w/output to files in ./tmp -- you need

extension of file-test primitives?

2017-08-19 Thread L A Walsh
Curious, but how difficult or problematic would it be to allow using brace-expansion (ex. {f,x} ) as a short-hand to test/combine file-op tests like: Allowing: test -{f,x} /bin/ls && ... or if [[ -{f,x} $file ]]; then ... ; fi instead of: test -f /bin/ls && test -x /bin/ls && ... ??

Re: Line wrapping issues

2017-08-20 Thread L A Walsh
Leon Klingele wrote: How to debug this? Try removing all functionality in fzf that still allows you to reproduce the bug. 'fzf' is producing "some output" which is causing confusion; trying to narrow that down would be the likely way to proceed. Alternatively, you might try running your combin

Re: extension of file-test primitives?

2017-08-20 Thread L A Walsh
PePa wrote: In that case, would not [[ =fx $file ]] be more workable and in line with common GNU short commandline option practice?? Do you mean '-fx' ? I assume you are meaning as an alternate? It would be fine with me, even better on an aesthetic sense, however, Bash already has multi-charac

Re: extension of file-test primitives?

2017-08-21 Thread L A Walsh
Peter & Kelly Passchier wrote: Sorry, indeed I meant: [[ -fx $file ]] All -ge -ne -eq etc. options are binary operators, while these new ones wpuld be unary, so I think the parsing would be unequivocal. --- Yeah, but as I said: While "-ge $file" could probably be parsed reliably apart from

Re: extension of file-test primitives?

2017-08-22 Thread L A Walsh
eliminate such problems. (reordered this to be first so I could 'reword' following examples for clarity) On 8/19/17 8:30 PM, L A Walsh wrote: Curious, but how difficult or problematic would it be to allow using brace-expansion (ex. {f,x} ) as a short-hand to test/combine file-op tests l

Re: extension of file-test primitives?

2017-08-22 Thread L A Walsh
Oops: meant to include this w/other response, but oh well.. Chet Ramey wrote: PePa wrote: In that case, would not [[ -fx $file ]] be more workable and in line with common GNU short commandline option practice?? No. If you're going to propose different functionality, don't use som

Re: extension of file-test primitives?

2017-08-22 Thread L A Walsh
Chet Ramey wrote: On 8/21/17 9:27 AM, Greg Wooledge wrote: You could write your own helper functions for this: -fx() { test -f "$1" && test -x "$1"; } This is indeed a quick and easy way to implement desired functionality. Shell functions can do a lot. Alas, they don't wor

Re: extension of file-test primitives?

2017-08-23 Thread L A Walsh
Greg Wooledge wrote: They're not intended to work that way. If you want to test f+x+s then you just make another function: -fxs() { test -f "$1" && test -x "$1" && test -s "$1"; } How many different single-ops? over 20? That's 20 factorial combos. You wanna include that in a script?

Re: extension of file-test primitives?

2017-08-23 Thread L A Walsh
Interestingclever, even though not well vetted here, either. Pierre Gaston wrote: You can use a loop, here is hack(ish) function that perhaps work (ie not tested too much): testfile () { local OPTIND=1 f=${!#} while getopts abcdefghLkprsSuwxOGN opt; do case $opt in [abcdefghLk

aliases not supported by default in non-interactive mode...but POSIX required?

2017-08-24 Thread L A Walsh
I was directed to the POSIX section on aliases and it doesn't say they are only to be enabled during interactive mode, but seem to be a required compatibility feature even when running non-interactively: = 2.3.1 Alias Substitution ^[UP XSI ] [Option Start] The processing of aliases

Re: aliases not supported by default in non-interactive mode...but POSIX required?

2017-08-24 Thread L A Walsh
Eric Blake wrote: On 08/24/2017 08:49 PM, L A Walsh wrote: However, in testing posix and non-posix modes in bash 4.4.12, I don't see aliases being enabled in scripts. That's what happens when you run your script in bash mode, rather than POSIX mode. My scripts were:

(OffTopic,) Gnu-Environment restrictions (was Re: Question )

2017-09-23 Thread L A Walsh
Bob Proulx wrote: Robert Elz wrote: But any restrictions on the recipient mean that the software is not really free, and that includes nonsense like requiring users to redistribute the sources to anyone who wants it. That's not freedom, that's an obligation (serfdom - you have to do my work

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-29 Thread L A Walsh
Chet Ramey wrote: This is all correct. The change was introduced for a reason, and accommodating a rare occurrence by backing it out would be non- productive. --- The reason?: Why does bash clear OLDPWD when a child script is started? OLDPWD is exported and passed to any children, but bas

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-29 Thread L A Walsh
Eduardo � wrote: On Fri, Sep 29, 2017 at 12:51:37AM -0700, L A Walsh wrote: Why does bash clear OLDPWD when a child script is started? OLDPWD is exported and passed to any children, but bash apparently clears OLDPWD whenever a child script is started... GNU bash, version 4.1.2(1)-release

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-30 Thread L A Walsh
Mikulas Patocka wrote: I don't set up OLDPWD in /etc/profile. --- No one does -- unless someone is trying to cause mischief. It's not a likely event, but it would be annoying if someone did it. But, FWIW, -- it seems like not using 'tainted' values from the environment in a LOGIN SHE

RFE & RFC: testing executability

2017-09-30 Thread L A Walsh
I was looking at a script that tested command for execute before executing them. The script used: cmd=$(PATH=/stdpath type -p cmd) and later tested executability with "-x $cmd", raising 2 problems. The first was "-p" returning empty if "cmd" was an alias or function. Second was that even

Bash should reset OLDPWD upon login, *only*.

2017-10-01 Thread L A Walsh
Mikulas Patocka wrote: The problem occurs even in non-login shells - the chrome browser is started from a bash script, on some distributions firefox is also started from a bash script, mail daemon may start a script specified in user's ".forward" file. And these scripts also poke $OLDPWD

  1   2   3   4   >