On Fri, Jul 08, 2022 at 01:52:04PM +0300, Yair Lenga wrote:
> While you can achieve results similar to 'errfail' with existing bash
> commands (you will need more than && !), the required effort is not
> practical:
> * Consider a common scenario (for me) - a script with 1000 lines, complex
> logic,
On Sun, Jul 10, 2022 at 02:35:40PM +0200, Anton Wessel wrote:
> When a one-liner is long, longer than fits on current window size, then
> problems in bash occure.
>
> This has nothing to do with what is the contents of the long line.
>
> Bash is broken by the fact that window size is exceeded.
>
On Mon, Jul 11, 2022 at 10:14:12PM +0800, root@ROCKY8-5-WL.localdomain wrote:
> [Detailed description of the problem, suggestion, or complaint.]
> in bash the result of $[23**15] is wrong
> for example output
> [root@ROCKY8-5-02 ~]#echo $[23**15]
> 8380818432457522983
> [root@ROCKY8-5-02 ~]#e
On Mon, Jul 11, 2022 at 10:41:40PM +0700, Robert Elz wrote:
> Should we be attempting to reply to root@ROCKY8-5-WL.localdomain ?
>
> I'm not going to bother.
Same.
> ps: Isn't $[ supposed to be obsolete?
It's deprecated and undocumented. But Chet never removed the actual
code, presumably in or
On Fri, Jul 29, 2022 at 03:59:07AM +0200, Emanuele Torre wrote:
> This enables defininng a "really_unset" function like so:
>
> really_unset () { unset "$@" ;}
>
> Which may be useful I guess.
https://lists.gnu.org/archive/html/bug-bash/2010-05/msg00045.html
https://fvue.nl/wiki/Bash:
On Mon, Aug 01, 2022 at 04:37:18PM +0900, Dominique Martinet wrote:
> Harald Dunkel wrote on Mon, Aug 01, 2022 at 09:08:40AM +0200:
> > a colleague pointed me to a changed behavior of bash 5.1.4 in Debian 11.
> >
> > #! /bin/bash
> > # set -x
> >
> > insert()
> > {
> >local data="$1"
> >
On Thu, Aug 11, 2022 at 04:04:57PM +0200, Steffen Nurpmeso wrote:
> Hm. Well i agree that precedence rules which loose a construct
> completely (in that =5 is lost in I=5?I:J) is weird, but other
What's that even supposed to *be*? You're assigning I=5 and then
checking whether the assignment act
On Sat, Aug 13, 2022 at 06:51:04AM +0700, Budi wrote:
> It doesn't work means no use on set -x, no value is shown
set -x shows the command being executed, with arguments expanded.
unicorn:~$ cat foo
#!/bin/bash
set -x
a=5
b=7
c=$((a * b))
echo "$c"
unicorn:~$ ./foo
+ a=5
+ b=7
+ c=35
+ echo 35
On Mon, Aug 15, 2022 at 07:05:49PM +0200, felix wrote:
> Description:
> Trying some script under 5.2 beta, rc1 and rc2, I was surprised by
> execution time.
Pre-release versions of bash are built with extra debugging stuff, and
will not perform like full-release versions.
On Sun, Aug 28, 2022 at 10:47:38AM -0400, Yair Lenga wrote:
> Hi,
>
> I've noticed Bash code uses "old-style" C89 declarations:
> * Parameters are separated from the prototype
> * Variables declared only at the beginning of the function
> * No mixed declaration/statements
> * No block local variab
On Sun, Aug 28, 2022 at 08:47:24PM -0400, Dale R. Worley wrote:
> The "obvious" way to support Json in Bash would be a utility that parses
> Json and produces e.g. a Bash associative array, and conversely a
> utility that reads a Bash associative array and produces Json. The real
> limitation is t
On Mon, Sep 05, 2022 at 09:55:29PM +0100, Julian Gilbey wrote:
> if [ ("$1" = "yes" -o "$1" = "YES") -a ("$2" = "red" -o "$2" = "RED") ]
You're doing it wrong. The parentheses have to be quoted, and separate.
[ "(" "$1" = yes" -o "$1" = YES" ")" -a ... ]
I'd strongly recommend that you DON'T do
On Tue, Sep 06, 2022 at 11:55:52AM -0400, Chet Ramey wrote:
> On 9/4/22 10:48 PM, Hyunho Cho wrote:
>
> > Bash Version: 5.1
> > Patch Level: 16
> > Release Status: release
> >
> > ##
> >
> >
> > "gcc --help" is already a short str
On Tue, Sep 06, 2022 at 10:11:00PM +0200, Martin Schulte wrote:
> Hi!
>
> > Running with this assumption, now that we know bash's extglob matching
> > will not perform suitably for this task, we can look at other approaches.
>
> Here's another:
>
> printf -- '%s ' $(gcc --help) | sed 's/ $/\n/'
On Sun, Sep 25, 2022 at 03:44:35AM +0700, Robert Elz wrote:
> (in this message, \s represents a space, just for clarity - \s meaning space
> cannot be used in shells, any of them, anywhere)
Just for the record, if \s appears in the regex on the right hand side
of =~ in bash's [[ $string =~ $regex
On Fri, Oct 07, 2022 at 01:28:59AM +1000, Martin D Kealey wrote:
> I write nested functions quite often, usually with a subsequent `unset -f`
> but sometimes (necessarily) without.
>
> Being able to write `local -F funcname { ... }` or `function -L funcname {
> ... }` would be a nice replacement f
On Tue, Oct 11, 2022 at 12:38:44PM -0700, Koichi Murase wrote:
> As far as I know, glob/extglob
> does not have constructs that cannot be represented by formal regular
> languages so should always be able to be represented by NFAs and thus DFAs.
It's been too many decades since I studied this stuf
On Thu, Oct 13, 2022 at 10:42:02AM -0400, Bryan Roessler wrote:
> Description:
>
> bash-5.2# declare -A a
> bash-5.2# a[foo]=bar
> bash-5.2# [[ -v a[@] ]]; echo $?
> 1
>
> bash-5.1# declare -A a
> bash-5.1# a[foo]=bar
> bash-5.1# [[ -v a[@] ]]; echo $?
> 0
>
> If this is by design I missed it.
On Thu, Oct 13, 2022 at 02:35:55PM -0400, Chet Ramey wrote:
> On 10/13/22 12:47 PM, Bryan Roessler wrote:
> > For indexed arrays, yes. I hadn't made the connection with associative
> > arrays since I don't typically index them with numbers, thanks.
>
> There has to be some default, and "0" is at l
On Fri, Oct 28, 2022 at 03:44:34PM +0900, Hyunho Cho wrote:
> # this is just for testing purposes.
> $ foo=$( gcc -v --help 2> /dev/null | sed -En 's/^\s*(-[^ ]+).*/\1/p' )
The last time this issue was reported, we mentioned that "gcc --help"
is not a standard document that appears the same on eve
On Sat, Oct 29, 2022 at 04:50:00PM +1100, Martin D Kealey wrote:
> This seems like a good reason to simply translate extglobs into regexes,
> which should run in linear time, rather than put effort into building and
> debugging a parallel implementation.
This isn't straightforward, because of the
On Mon, Oct 31, 2022 at 03:40:34AM +0200, Oğuz wrote:
> > Option B: Fix the line editor to take into account when the
> > prompt doesn't start at column 0.
> >
> >
> Yeah, or add a new prompt sequence (e.g. \N) that prints a newline only if
> the cursor is not at column 0.
There's no 100%
On Mon, Oct 31, 2022 at 05:00:40AM +0200, Oğuz wrote:
> 31 Ekim 2022 Pazartesi tarihinde Martin D Kealey
> yazdı:
> > If we use the standard POSIX BRE or ERE, then there's no additional code to
> > ship; it's included as part of the OS. The hard part is what to do with
> > (!LIST), which was the p
On Mon, Oct 31, 2022 at 06:12:14PM +0100, Alex fxmbsw7 Ratchev wrote:
> hi , sorry.. whats the purpose of local -
> informational question
a. Since there is no `declare -' equivalent of `local -', make sure to use
`local -' in the output of `local -p'.
-
s. The `local' builtin takes a ne
On Fri, Nov 04, 2022 at 03:31:44AM +0900, Koichi Murase wrote:
> 2022年11月4日(金) 2:50 Andreas Schwab :
> > On Nov 03 2022, thierryb--- via Bug reports for the GNU Bourne Again SHell
> > wrote:
> > > Description:
> > > String substitution code running for years is broken in 5.2.
> > >
> > > Rep
On Fri, Nov 04, 2022 at 04:09:10AM +0900, Koichi Murase wrote:
> When one wants to also support Bash 4.2, one possible workaround is to
> assign the result to a variable (without quoting the right-hand side
> of the assignment):
>
> $ bash-4.2 -c 'string=\"hi\"; string=${string//\"/\"}; echo "$str
On Thu, Nov 03, 2022 at 05:20:52PM -0400, Greg Wooledge wrote:
> On Fri, Nov 04, 2022 at 04:09:10AM +0900, Koichi Murase wrote:
> > When one wants to also support Bash 4.2, one possible workaround is to
> > assign the result to a variable (without quoting the right-hand side
> &
On Fri, Nov 04, 2022 at 09:50:03AM +0100, Alex fxmbsw7 Ratchev wrote:
> On Fri, Nov 4, 2022, 08:56 Léa Gris wrote:
>
> > Le 03/11/2022 à 19:50, Chet Ramey écrivait :
> > > The option is enabled by default. If you want to restore the previous
> > > behavior, add `shopt -u patsub_replacement'.
> >
On Fri, Nov 04, 2022 at 01:30:16PM +0100, Alex fxmbsw7 Ratchev wrote:
> > 1) Put something like "shopt -u patsub_replacement 2>/dev/null || true"
> >at the top of your script.
> >
>
> there d be many such senselessnesses
>
> >
> > 2) Assign the result of the expansion to a temporary variable,
On Fri, Nov 25, 2022 at 03:40:42PM -0600, G. Branden Robinson wrote:
> I don't think it is a bug. It is unspecified behavior according to
> POSIX.
>
> "-v" is not an operator according to POSIX, and I don't recall seeing it
> in any shell. It is therefore interpreted as a string argument.
[...]
On Sat, Nov 26, 2022 at 10:09:22AM +0700, Robert Elz wrote:
> My preferred method for this, which works for all kinds
> of variables and parameters is
>
> test "${X+s}" = s
>
> where X is whatever is to be tested (1 in this case)
> and "s" is any string you like, except "" .. must be
> the
On Mon, Nov 28, 2022 at 05:00:28PM -0500, Dale R. Worley wrote:
> Alexey via Bug reports for the GNU Bourne Again SHell
> > Same behavior was in bash 4.4 (as well as now in bash 5.2):
> >
> > # echo $BASH_VERSION
> > 4.4.0(1)-release
> > # exec 66 > # pvs
> > File descriptor 66 (/etc/hosts) leaked
On Fri, Dec 02, 2022 at 11:28:50AM +0100, Ulrich Windl wrote:
> Surprisingly "declare XXX=$(false);echo $?" outputs "0" (not "1")
https://mywiki.wooledge.org/BashPitfalls#pf27
On Sat, Dec 03, 2022 at 05:40:02AM -0500, Yair Lenga wrote:
> I was recently asked to deploy a bash/python based solution to windows
> (WSL2). The solution was developed on Linux. Bash is being used as a glue
> to connect the python based data processing (pipes, files, ...). Everything
> works as
On Thu, Dec 15, 2022 at 10:55:51AM +, y...@liberman.co.il wrote:
> function sa {
> for y in $(seq $1 $e2); do
> echo "echo search $y "
> done
> }
As others have pointed out, you've written $e2 instead of $2.
In addition to that, you're relying on the Linux-speci
On Fri, Dec 23, 2022 at 06:53:08PM -0500, Chet Ramey wrote:
> On 12/23/22 7:24 AM, Emanuele Torre wrote:
> > About two months ago, I discovered, reading the bash source code for
> > printf, the %n format specifier.
> >
> > What it does is assign to the variable specified as its argument, the
> > n
On Wed, Dec 28, 2022 at 01:09:02PM -0600, The Administrator wrote:
> Hello and happy holiday hacking. Does the read builtin stand to benefit
> from \[ and \] denotation ala $PS1 and friends? Here is a quick example:
>
> > read -erp "$( tput setaf 2 )NEW:$( tput sgr0 ) "
>
> Fill the line with “
On Fri, Dec 30, 2022 at 12:21:52AM +0100, Steffen Nurpmeso wrote:
> ..i want to reiterate the relation to what "human logic" expects.
I'm a human, so I feel qualified to address this point.
What I expect from a command like
(( i += j += i += j ))
is to get unpredictable results that have no rel
On Mon, Jan 02, 2023 at 10:13:28AM +0200, Yuri Kanivetsky wrote:
> Hi,
>
> #!/usr/bin/env bash
> set -eu
> alias cmd=echo
Aliases are not used in bash scripts, unless bash is invoked in POSIX
compatibility mode, or the "expand_aliases" shopt is turned on.
On Wed, Jan 04, 2023 at 12:21:27AM -0600, Carlos Prieto López wrote:
> Description:
> Errors are ignored when a command with error is assigned to a local
> variable on the same line of declaration.
>
> f(){
> return 1
> }
>
> g(){
> local v=`f`
> }
> g && echo g
> the output is 'g', but
On Sat, Jan 07, 2023 at 01:37:30AM +, Sam James wrote:
> $ cat /tmp/guess_suffix
> guess_suffix() {
> tmpdir="${TMPDIR}"/.ecompress$$.${RANDOM}
> }
> guess_suffix
> $ export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1"
> $ bash -x /tmp/guess_suffix
> + guess_suffix
> random.c:79:
On Fri, Jan 06, 2023 at 09:00:30PM -0500, Greg Wooledge wrote:
> On Sat, Jan 07, 2023 at 01:37:30AM +, Sam James wrote:
> > random.c:79:21: runtime error: signed integer overflow: 31789 * 127773
> > cannot be represented in type 'int'
> > #0 0x559791a301ce i
On Sat, Jan 07, 2023 at 07:08:06PM +0100, Andreas Schwab wrote:
> On Jan 07 2023, Greg Wooledge wrote:
>
> > I think this patch might be correct:
> >
> >
> > --- lib/sh/random.c.orig2023-01-07 12:26:09.049950519 -0500
> > +++ lib/sh/random.c 2023-01-07 1
On Sat, Jan 07, 2023 at 01:42:20PM -0500, Greg Wooledge wrote:
> Or should the code do the multiplications with unsigned
> values, store them in unsigned variables, and then replace the subtraction
> with some kind of conditional that checks which of the two is greater?
Here's a ver
On Thu, Jan 12, 2023 at 03:43:15AM +, anonymous4feedb...@outlook.com wrote:
> Dear dir or madam,
>
> For the following script:
> alias a1='echo '
> alias a2=a1
> alias foo=bar
> a2 foo
> bash outputs ‘foo’, instead of ‘bar’.
>
> GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) on arc
On Fri, Jan 13, 2023 at 01:59:55AM +0700, Robert Elz wrote:
> Date:Thu, 12 Jan 2023 10:56:33 -0500
> From:Chet Ramey
> Message-ID: <0f03dd45-3e1a-54b1-f884-d3fb2c1c7...@case.edu>
>
> | Bash has never extended the `expand next word' semantics to multiple-level
> |
On Mon, Jan 16, 2023 at 11:36:18AM -0600, dave.dram...@gmail.com wrote:
> hence `set -x`, but I want the output to go to stdout rather than
> stderr so
> that cron emails me only when there is an actual failure. With this
Cron sends email if there's any output on either stdout or stde
On Wed, Jan 18, 2023 at 02:45:29AM +0100, alex xmb ratchev wrote:
> aliases are major essential part of functionality
Disagree.
> that u cant , and speak against , all the time , is only enemish nonsense
Don't worry. They're not going anywhere. They're shit, but you will
still be allowed to pl
On Fri, Jan 20, 2023 at 12:08:36AM +, Peter wrote:
> Currently, in the event bash or something below it crashes, that
> session's command history is lost.
> It would be nice if bash saved it somewhere periodically, it doesn't
> have to be too often, let's say on every second command.
History m
On Fri, Jan 20, 2023 at 11:50:52PM +0100, Martin Schulte wrote:
> Hello Nicolas!
>
> > bash-5.1$ echo () { echo test }
> > > echo test
> > > }
> > bash-5.1$ echo
> Most probably you want to insert a ; before the first closing }:
>
> echo() { echo test ; }
>
> But even now bash w
On Sat, Jan 21, 2023 at 01:55:27PM +0100, Tycho Kirchner wrote:
> cmd1 &
> cmd2 &
> wait
>
> If the user having launched this script from the interactive terminal aborts
> it by hitting Ctrl+C, by default, the shell sends SIGINT to the process group
> (pgid) of the script. However, while cmd1 an
On Wed, Jan 25, 2023 at 03:00:27PM -0500, Dale R. Worley wrote:
>
> Tracing with -x prints a lot of (usually) useless lines.
>
> $ bash -x ./tt
> [300+ lines of Bash initializations]
> + echo 'Now in tt.'
> Now in tt.
Why does it do this? Have you got BASH_ENV set to something i
On Thu, Jan 26, 2023 at 12:03:08PM -0500, Dale R. Worley wrote:
> I do have BASH_ENV set, to ~/.bashrc. I need that so that my scripts
> can use my .bashrc customizations.
I strongly advise against this. All of the things a script does should
be discoverable by reading the script, and any files
On Thu, Feb 02, 2023 at 04:47:34PM +1000, Martin D Kealey wrote:
> > ...in posix mode, fname must be a valid shell name and may not be the name
> > of one of the POSIX special builtins.
> > In default mode, a function name can be any unquoted shell word that does
> > not contain $. ...
>
> I'm gu
On Thu, Feb 02, 2023 at 03:02:41PM -0500, Dale R. Worley wrote:
> Greg Wooledge writes:
> > I'd be totally OK with restricting the function namespace a bit more.
> > Function names should not be allowed to contain backticks or less-than
> > or greater-than signs (
On Fri, Feb 03, 2023 at 06:38:36AM +0700, Robert Elz wrote:
> which is harmless, unless the shell is badly breaking the command
> execution rules of POSIX (zsh does I believe) but because for any
> shell that follows those rules, it is impossible to invoke a function
> with a '/' in its name.
unic
On Wed, Feb 15, 2023 at 05:35:10PM +0100, Mike Jonkmans wrote:
> I once had that same issue:
> https://lists.gnu.org/archive/html/bug-bash/2015-10/msg00013.html
>
> Conclusion: the shopt is not yet working until the function has been run.
> (or after the line has been parsed).
Yes. This is not a
On Thu, Feb 16, 2023 at 07:21:14PM -, Syed Maaz wrote:
> Hey Team,
>
> I am a security researcher,I have found this vulnerability related to
> your website bash-hackers.org.
Just for the record, "bash-hackers.org" is a third-party web site, not
affiliated with the Free Software Found
On Sun, Feb 19, 2023 at 03:05:24PM +0200, Mr. Dick Steel wrote:
> 4. Use up arrow to scroll cmd history up until you hit:
> "$ valgrind --leak-check=full ./target/debug/hostname-ip-address"
> and press up arrow once more and you will get:
> "$ valgrind -cd rust/hostname-
On Sat, Mar 11, 2023 at 10:50:21AM +0800, zju wrote:
> So is it possible to optimize the continuous growth of memory occupied by
> child processes?
Someone will have to find where the memory leak is occurring. You'll
want a more controlled reproducer than an infinite fork bomb.
> Or is there an
On Thu, Mar 16, 2023 at 05:21:23PM +0100, Tycho Kirchner wrote:
> Hi,
> when compiling bash with a plain
>
> mkdir build; cd build; ../configure && make
>
> the login shell detection (leading dash: -bash) is apparently broken - at
> least, ~/.bashrc is not sourced.
What you're referring to is a
On Tue, Mar 21, 2023 at 04:52:03PM -0400, Grisha Levit wrote:
> On Tue, Mar 21, 2023 at 4:11 PM Chet Ramey wrote:
> > OK, which do you think would be the more common case? Wanting the options
> > used to generate completions to persist or using it in this way?
>
> Usually people do `COMPREPLY=($(
On Mon, Mar 27, 2023 at 12:24:35PM -0700, L A Walsh wrote:
> interactive:
>
> readarray out< <(ssh -n -T "$user@$host" 'printf "1\n2\n3\n4\n5\n"' 2>&1);
> printf "%s" "${out[@]}"
> In script:
>
> on_host athenae 'printf "1\n2\n3\n4\n5\n"' Using host athenae
> 103: host athenae, up
> Read 1 lines
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_exchange_identification: read: Connection reset by peer)'
>ign3='(packet_wri
On Mon, Mar 27, 2023 at 04:43:09PM -0700, L A Walsh wrote:
> On 2023/03/27 13:28, Greg Wooledge wrote:
> > You're calling filter_ssh with no arguments, but trying to use "$@"
> > inside it to generate the ssh command.
> Isn't "$@" still valid?
On Thu, Mar 30, 2023 at 05:12:46AM -0600, Felipe Contreras wrote:
> IFS=,
> str='foo,bar,,roo,'
> printf '"%s"\n' $str
>
> There is a discrepancy between how this is interpreted between bash
> and zsh: in bash the last comma doesn't generate a field and is
> ignored,
... which is corr
On Thu, Mar 30, 2023 at 11:52:06AM -0600, Felipe Contreras wrote:
> Not to mention the small detail that the Internal Field Separator is
> not a *separator*, but a terminator (with certain exceptions).
POSIX itself admits that the name is confusing. From sh(1posix):
RATIONALE
[...]
On Sat, Apr 01, 2023 at 07:44:10PM -0400, Saint Michael wrote:
> There is an additional problem with IFS and the command read
>
> Suppose I have variable $line with a string "a,b,c,d"
> IFS=',' read -r x1 <<< $line
[...]
https://mywiki.wooledge.org/BashPitfalls#pf47
On Mon, Apr 03, 2023 at 12:28:25AM +0700, Robert Elz wrote:
> bash is parsing the <() as a process substitution, producing nothing.
> The only chars in the bracket expression will then be . and [ which
> explains the result.
That does seem like a bug, to be fair.
> Try instead
>
> bash
On Tue, Apr 04, 2023 at 08:34:02PM +0800, Dan Jacobson wrote:
>There probably was.
>Say, there should be a way to protect the user against something like
>that. I wish I could just tell it to only allow utf-8 in my history.
Can you please look in the history file, and confirm whether
On Mon, Apr 17, 2023 at 10:23:17AM -0700, Wiley Young wrote:
> Description:
> When an array 'a_foo' is created with 'mapfile -d '' -t', it is
> tested with '[[ -v a_foo ]]' and '[[' returns 0. When '-O 1' is added to
> mapfile, '[[ -v a_foo ]]' returns non-0.
It's not specifically the -O1
On Mon, May 08, 2023 at 08:28:36AM +0200, alex xmb ratchev wrote:
> On Mon, May 8, 2023, 04:07 Hyunho Cho wrote:
> > bash$ julia <( cat <<\@ ) 11 22 33
> > for a in ARGS println(a) end
> > @
> > bash: warning: command substitution: 1 unterminated here-document
> > 11
> > 22
> > 33
> >
>
> i d gue
unicorn:~$ tty
/dev/pts/0
unicorn:~$ ps -ft pts/2
UID PIDPPID C STIME TTY TIME CMD
greg 973 959 0 Apr29 pts/200:00:00 bash
greg 942813 973 0 07:29 pts/200:00:00 sleep 5
greg 942814 973 0 07:29 pts/200:00:00 sleep 7
unicorn:~$ ps
On Fri, May 19, 2023 at 01:36:44PM +0200, alex xmb ratchev wrote:
> 'C ..'
> ' ..'
> '| ..'
>
> .. i dont get it
Yeah, the wording isn't ideal. I'd start it out like this:
${ COMMAND; }
${| COMMAND; }
Execute COMMAND in the current execution environment
The first form (where the c
On Fri, May 19, 2023 at 02:25:15PM +0200, alex xmb ratchev wrote:
> On Fri, May 19, 2023, 13:54 Greg Wooledge wrote:
>
> > On Fri, May 19, 2023 at 01:36:44PM +0200, alex xmb ratchev wrote:
> > > 'C ..'
> > > ' ..'
> > > '| ..
On Fri, May 19, 2023 at 06:35:50PM +0200, alex xmb ratchev wrote:
> so that i understand ,
>
> var=${ awk ... }
There's no reason to use this new thing if you're calling awk, because
awk is an external program. You might as well just use var=$( awk ... )
instead.
Either way, you're going to for
On Mon, May 22, 2023 at 07:01:18AM +1000, Martin D Kealey wrote:
> [...] and treating "unset" as a fatal error is not the experience that
> programmers have using other scripting languages, and is therefore, I would
> argue, not something that should be added to the Shell, and certainly not
> as a
On Fri, Jun 02, 2023 at 09:01:11AM -0400, Chet Ramey wrote:
> On 6/1/23 9:01 PM, rpaufin1 wrote:
> > Consider the following script:
> >
> > #!/bin/bash
> >
> > f() {
> > ls missing-file 2> /dev/null
> > echo "test"
> > }
> >
> > # 1
> > (set -e; f); ret=$?
> > if (( ret )); the
On Fri, Jun 16, 2023 at 10:59:24AM -0400, Lawrence Velázquez wrote:
> % /bin/bash -c 'foo= declare -ax foo'
> zsh: segmentation fault /bin/bash -c 'foo= declare -ax foo'
>
> I am seeing this behavior with bash 3.2.57, so it appears to be
> longstanding.
I get a segfault/core dump in every versio
On Sat, Jun 17, 2023 at 09:09:23AM +0530, LitHack wrote:
> Running the yes command in command substitution will crash the linux shell.
Not surprising, really. You're trying to capture and store an
infinite number of bytes in memory. Eventually, either the malloc is
going to fail due to lack of v
On Wed, Jun 21, 2023 at 08:22:19AM +0530, LitHack wrote:
> Special character '*' can be used to execute the command.
"Doctor, it hurts when I bend my arm like this!"
On Wed, Jun 21, 2023 at 09:25:02AM +0530, LitHack wrote:
> Sorry instead of alias we have to use the function.
>
> Corrected command: mkdir dir;cd dir;<>file;file()bash;*
Even if we correct your "corrected" code for you, the basic issue
remains: what "bug" are you claiming exists here? How does
eclare an alias, if issued in a subshell.
I don't normally use it either, so let's try it and see:
unicorn:~$ zsh
greg@unicorn ~ % alias
which-command=whence
greg@unicorn ~ % (alias)
which-command=whence
greg@unicorn ~ % (alias x=date; alias)
which-command=whence
x=date
The alias def
On Mon, Jun 26, 2023 at 03:36:58PM -0300, Hugo Napoli wrote:
> #!/bin/bash
>
> clear
>
> echo ""
> read -p "Ingrese un número entero de hasta 2 cifras
> : " min
> read -p "Ingrese otro número entero de hasta 2 cifras, mayor que el
> anterior : " max
>
> if [[ ${#min} -gt 2 ]] || [[ ${#max}
On Tue, Jun 27, 2023 at 06:24:30AM -0500, Dennis Williamson wrote:
> Your first assignment is a way to assign a list of members to an
> associative array. Your second assignment creates a single element with the
> index "[a]=b [c]=d" which has a null value.
I'm seeing some parser voodoo here.
uni
uot; mydatabase
EOF
This is also described in a bit more detail at
<https://mywiki.wooledge.org/BashProgramming/05#Passing_arguments_to_ssh>.
I recommend reading that whole page when you get a chance.
Here it is in action:
unicorn:~$ password='$foo&bar'
unicorn:~$ ssh localhost bash -s "${password@Q}" <<-'EOF'
> printf 'Password is <%s>\n' "$1"
> EOF
greg@localhost's password:
Password is <$foo&bar>
On Fri, Jun 30, 2023 at 03:49:23PM +0200, Sebastian Luhnburg wrote:
> You suggest to use an argument, to pass the password. Please correct me if I
> be wrong, but to write one or more password(s) in clear text as an argument
> in the terminal (./myscript.sh password1 password2) is not the best prac
he password"
> > EOF
I wish you would remove the layers of obfuscation here, and just state
clearly what you're doing.
Why are you running /bin/bash inside the script which is already
being executed by the remote user's shell? Is this is a stand-in for
some other program
On Sat, Jul 01, 2023 at 05:47:33AM +0900, Dominique Martinet wrote:
> hm, this has the password show up in ps on the box executing ssh;
> depending on the context that can be bad.
Fair enough. We have no way to judge the OP's risk analysis, because
they've kept almost everything secret so far.
I
On Sat, Jul 01, 2023 at 02:45:16PM +0200, alex xmb ratchev wrote:
> declare -p
> works well for transmitting bash vars around via ssh
>
> ssh foo "$(declare -p vars)
> more code"
I haven't tested that thoroughly, but it looks OK. However, it doesn't
address the problem in this thread, which is t
On Sun, Jul 02, 2023 at 03:04:25PM +0200, Top Dawn wrote:
> >
> > What makes you think so? Variables are always visible in invoked
> > functions, unless you shadow them using local/declare/typeset.
> >
>
> Thank you very much for this information, I didn't know invoked functions
> inherited their
On Sun, Jul 02, 2023 at 08:56:08PM -0400, Lawrence Velázquez wrote:
> On Sun, Jul 2, 2023, at 8:30 PM, Dan Jacobson wrote:
> > OK, but do please mention somewhere that "if the variable is set more
> > than once within the same statement, the final value is used."
> >
> > $ m=1 m=2; echo $m
> > #(Y
On Tue, Jul 04, 2023 at 10:40:26AM +0200, alex xmb ratchev wrote:
> On Tue, Jul 4, 2023, 01:52 Chet Ramey wrote:
>
> > On 7/3/23 5:56 PM, alex xmb ratchev wrote:
> >
> > > looked into non finite number libs ?
> > > gawk like .. ?
> >
> > bignums? No. intmax_t is enough for the shell.
> >
>
> yea
On Wed, Jul 19, 2023 at 09:06:20AM -0400, Chet Ramey wrote:
> On 7/18/23 10:01 PM, alex xmb ratchev wrote:
> > i in 5.2.15 bash aarch64 termux did
> >
> > $ cp -ap db2.*/
> >
> > and got
> >
> > db2.i5// db2.i7//
>
> I can't reproduce this.
It's probably an artifact of some Linux vendor's prog
On Thu, Jul 20, 2023 at 11:03:35PM +1000, Martin D Kealey wrote:
> On Thu, 20 Jul 2023, 18:03 Grisha Levit, wrote:
>
> > Sounds like you want all the commands in the alias to be executed as a
> > group -- so you can just write it as one:
> >
> > alias bad='{ echo fail; continue; }'
> >
>
> That
On Fri, Jul 21, 2023 at 12:33:07AM +1000, Martin D Kealey wrote:
> C has longjmp, and other languages have exceptions. Non-local break is a
> usable "Bash shaped" analogue of those. Not perfect, sure, but close enough
> to be useful. (Non-local continue is a logical extension of that.)
>
> Saying
On Fri, Jul 21, 2023 at 01:15:16PM +0200, alex xmb ratchev wrote:
> On Thu, Jul 20, 2023, 8:09 PM Greg Wooledge wrote:
> > On Fri, Jul 21, 2023 at 12:33:07AM +1000, Martin D Kealey wrote:
[...]
> > Well in any case, the behavior you wanted is not reliable across shells,
>
On Wed, Jul 26, 2023 at 08:42:15AM -0400, Zachary Santer wrote:
> To restate what's in the video, you can't safely use echo to print the
> contents of a variable that could be arbitrary, because the variable could
> consist entirely of '-n', '-e', or '-E', and '--' is not interpreted as the
> end o
On Mon, Aug 07, 2023 at 01:56:21PM +, Kamil Cukrowski Priv wrote:
> Hi, when BASH_SUBSHELL is part of a pipeline with just a simple command it
> does not increment. Consider the following:
> # docker run -ti --rm bash bash -c 'echo $BASHPID $BASH_SUBSHELL; echo |
> echo $BASHPID $BASH_SUBSHELL'
On Mon, Aug 14, 2023 at 06:40:28AM +0100, Kerin Millar wrote:
> On Mon, 14 Aug 2023 02:11:27 +
> pphick via Bug reports for the GNU Bourne Again SHell
> wrote:
>
> > If a string starts with '-e' the replacement operators ${x//,/ } and ${x/,
> > /} drop the '-e'.
> > The behaviour seems to b
201 - 300 of 1972 matches
Mail list logo