The date command for time is incorrect
Why the date command for time is incorrect and different from the correct one on panel bar $ date +%H 04 $ date +%I 04 while the correct is on panel bar which is 11 (real in 0..24 form, i.e. AM) Please help this confusing trouble
Re: How come math/arithmetic cannot work by set -x
It doesn't work means no use on set -x, no value is shown On 8/13/22, Dennis Williamson wrote: > On Fri, Aug 12, 2022, 6:28 PM Budi wrote: > >> How come math/arithmetic ((i=k+l)) cannot make use of set -x >> >> Please help.. >> (so annoying). >> > > > It works for me. What are you expecting? > > It would help if you show what you're doing, the result you're getting and > what you expect instead. > > "It doesn't work" conveys no information whatsoever. > >> >
How come math/arithmetic cannot work by set -x
How come math/arithmetic ((i=k+l)) cannot make use of set -x Please help.. (so annoying).
Missing Backspace command in the readline
What is the Backspace code in the readline, i.e. .inputrc file (as the source come with explanation Ctrl-Backspace ( \b ) but not Backspace) ?
Why tail coreutil cannot work as its input is from tee
How come tail coreutil cannot work as its input is from tee $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tail -1 1 But : $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tee >(head -1) |tail -1 9 Please help explain
Re:
On 3/22/21, Greg Wooledge wrote: > On Mon, Mar 22, 2021 at 09:50:06AM +0000, Budi wrote: >> in a function k() in ~/.bashrc >> >> k(){ unset u;h=0; o=(${h:+ ! -path "./*.txt"}) ;u=($u "${o[@]}"); c=(. >> -regextype posix-extended "${b[@]}" -print); find "${c[@]}" >> } >> >> in output set -x: >> >> + unset u >> + h-0 > > This is clearly a falsehood. You didn't paste the actual output. > >> + o=(${h:+ ! -path "./*.txt"}) >> + u=($u "${o[@]}") > > Why have the unquoted $u here when you know the variable is unset? > >> + c=(. -regextype posix-extended "${b[@]}" -print) > > What's in the array "b"? You never showed any such array. > >> + find . -regextype posix-extended ' ! -path ./*.txt' -print >> find: paths must precede expression: ` ! -path ./*.txt' >> >> Why and how to solve ? > > I think your real question is this one -- why did the exclamation point > and the word -path and the word ./*.txt all get squashed together into > a single word, instead of being inserted as three separate words? > > If you can simplify your code down to *just* that case, and if you can > show an actual reproducer for it, then we might try to reproduce it > ourselves. > > As it is now, I don't trust what you've written here, because you clearly > haven't been honest about it, and you haven't shown the actual commands > you ran ("set -x output" of what??), let alone the actual output. > You're absolutely precisely correct! messed up the real case with the transformed code one as it's in hurry, here fixed simplified one: unset b;u=7; o=(${u+ ! -path "./*.txt"}) ;b=($b "${o[@]}"); c=(. -regextype posix-extended "${b[@]}" -print); find "${c[@]}" absolutely work.. when deployed in a function in ~/.bashrc it failed as said so confusing why, what the glitch causing it
[no subject]
The conditional variable not work in function in a script ie ~/.bashrc while works in shell term. $ unset u;h=0; o=(${h:+ ! -path "./*.txt"}) ;u=($u "${o[@]}"); c=(. -regextype posix-extended "${b[@]}" -print); find "${c[@]}" or type $ k(){ unset u;h=0; o=(${h:+ ! -path "./*.txt"}) ;u=($u "${o[@]}"); c=(. -regextype posix-extended "${b[@]}" -print); find "${c[@]}" ;} $ k works in a function k() in ~/.bashrc k(){ unset u;h=0; o=(${h:+ ! -path "./*.txt"}) ;u=($u "${o[@]}"); c=(. -regextype posix-extended "${b[@]}" -print); find "${c[@]}" } in output set -x: + unset u + h-0 + o=(${h:+ ! -path "./*.txt"}) + u=($u "${o[@]}") + c=(. -regextype posix-extended "${b[@]}" -print) + find . -regextype posix-extended ' ! -path ./*.txt' -print find: paths must precede expression: ` ! -path ./*.txt' Why and how to solve ?
'Find' inside loop buggy, incorrectly make up dir.
find or bash or anything has made a bit buggy behavior for n in dircopy dircopy1 ;{ sudo find /usr/bin /usr/local -regextype posix-extended -iregex '.*|.*' '(' -type d '(' -path '* *' -printf ''\''%p/'\''\n' -o -printf '%p/\n' ')' -o '(' -path '* *' -printf ''\''%p'\''\n' -o -printf '%p\n' ')' ')' -exec cp -r '{}' "$n" ';' } find make up bin dir. inside dircopy and target results are put there instead of on dircopy
Request: a command to do a return completely in normal, ie. not subshell
Can we have a command to do a return completely (as if it returns from main function) when it is being in a third nested function call, in order to get back to shell prompt at once, in normal, ie. not subshell? My main function invocation here will fully shut down terminal if exit command is given. c(){ local p #... [ "$p" = err ] && kill $TID #... } b(){ #... c #... } a(){ export TID=$$ #... b #... #... }
Feature request
How good it's if we can have Bash internal variable as default for loop counter, f(){ unset i for a;{ let ++i # ... } #... } so have that instead of $i for sake of efficieny or optimization, could be named any, $/, $! etc
How is it explained about the `local` is valid variable
Can we validly write a line unset local a b c d e f g h i to mean: local a b c d e f g h i;unset a b c d e f g h i if yes, how come local=9 is valid variable 'local' normally ? thanks much
Feature request
Need feature on while's readily flag $ i=;while ((i<5)) ;do let i++ ;echo $i ;done ;echo $? 1 2 3 4 5 0 $ i=7;while ((i<5)) ;do let i++ ;echo $i ;done ;echo $? 0 we need feature on while's ability to supply flag when it's up to the end of loop block Please fulfill this, it's really needed Thanks much before.
Re: bug-bash Digest, Vol 215, Issue 9
set -n not work as its supposed job to check validity of a command using Bash command inside a script ? for echo command checking $ set -n 'echo HI' & Y Y $ set -n 'eco HI' & Y Y won't do the check, how to solve ? On 10/10/20, bug-bash-requ...@gnu.org wrote: > Send bug-bash mailing list submissions to > bug-bash@gnu.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.gnu.org/mailman/listinfo/bug-bash > or, via email, send a message with subject or body 'help' to > bug-bash-requ...@gnu.org > > You can reach the person managing the list at > bug-bash-ow...@gnu.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of bug-bash digest..." > > > Today's Topics: > >1. Subject: Pressing Ctrl-C during any subshell evaluation > terminates the shell (Daniel Farina) > > > -- > > Message: 1 > Date: Fri, 9 Oct 2020 16:23:23 -0700 > From: Daniel Farina > To: bug-bash@gnu.org > Subject: Subject: Pressing Ctrl-C during any subshell evaluation > terminates the shell > Message-ID: > > Content-Type: text/plain; charset="UTF-8" > > Configuration Informatio: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=format-security > -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions > -fstack-protector-strong -grecord-gcc-switches > -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 > -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic > -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection > -Wno-parentheses -Wno-format-security > uname output: Linux shrike 5.8.9-200.fc32.x86_64 #1 SMP Mon Sep 14 18:28:45 > UTC 2020 x86_64 x86_64 x86_64 GNU/Linux > Machine Type: x86_64-redhat-linux-gnu > > Bash Version: 5.0 > Patch Level: 17 > Release Status: release > > Description: > > Pressing Ctrl-C during any subshell evaluation terminates the shell. I > noticed this when using direnv and emacs together: Ctrl-C would not cancel > a subprocess started by the shell, but would exit the entire shell. > > Relaying this from: https://github.com/direnv/direnv/issues/627 > > Repeat-By: > > Per https://github.com/direnv/direnv/issues/627#issuecomment-635611930 > > $ cat bash.rc > eval "$(direnv hook bash)" > > $ bash --rcfile bash.rc > bash$ echo $PROMPT_COMMAND > _direnv_hook > bash$ $(sleep 10) # pressing ^C during those 10 seconds will terminate the > shell > ^C > $ # inner shell terminated > > Fix: > > No known good fix. It does seem zsh manages the situation normally without > much difference in approach. Direnv 2.20.0 does not have this bug, but it > also has deficits in how it traps signals. > > > -- > > Subject: Digest Footer > > ___ > bug-bash mailing list > bug-bash@gnu.org > https://lists.gnu.org/mailman/listinfo/bug-bash > > > -- > > End of bug-bash Digest, Vol 215, Issue 9 > >
Re: Do a readline function execution inside bash
simply run a readline function among lines codes of bash script such a menu-complete, or previous-history repeated thrice, or etc On 9/15/20, Budi wrote: > simply run a readline function among lines codes of bash script such a > menu-complete, or menu-complete repeated thrice, or etc etc > > On 9/14/20, Greg Wooledge wrote: >> On Mon, Sep 14, 2020 at 10:09:16PM +0700, Budi wrote: >>> How to do a readline function execution inside bash script as mimic to >>> actual key press ? >> >> Please tell us what you're actually trying to do. It makes a huge >> difference. >> >> You said "script", so I guess you don't want to pre-populate the input >> buffer of an interactive shell. That would be one goal, and we could >> tell you how to do that, but if it's not what you want, that would be >> a waste of time. >> >> Perhaps you want to pre-populate the user's response to a prompt written >> by the script, for a read command. That's pretty easy: you just have to >> tell read to use readline (-e), and then supply an initial response (-i). >> >> read -r -e -i "$LOGNAME" -p "Who are you? " who >> >> If that's not what you want, then we need to know what you *do* want. >> >
Re: Do a readline function execution inside bash
simply run a readline function among lines codes of bash script such a menu-complete, or menu-complete repeated thrice, or etc etc On 9/14/20, Greg Wooledge wrote: > On Mon, Sep 14, 2020 at 10:09:16PM +0700, Budi wrote: >> How to do a readline function execution inside bash script as mimic to >> actual key press ? > > Please tell us what you're actually trying to do. It makes a huge > difference. > > You said "script", so I guess you don't want to pre-populate the input > buffer of an interactive shell. That would be one goal, and we could > tell you how to do that, but if it's not what you want, that would be > a waste of time. > > Perhaps you want to pre-populate the user's response to a prompt written > by the script, for a read command. That's pretty easy: you just have to > tell read to use readline (-e), and then supply an initial response (-i). > > read -r -e -i "$LOGNAME" -p "Who are you? " who > > If that's not what you want, then we need to know what you *do* want. >
Do a readline function execution inside bash
How to do a readline function execution inside bash script as mimic to actual key press ?
How anchor to line end in regex
How anchor to line end in bash regex [[ ]] h=hi [[ $h =~ ^hi\$ ]] && echo Yes cannot work, or is it bug yet
How to apply Bash completion usefully and more practically
How to apply Bash completion in more useful way. If TAB key is pressed Bash just show a list of corresponding command, I thought it will scroll over all corresponding command on which the cursor of shell prompt is active. (just like traditional Windows cmd prompt) How to make it able to perform such ? Thanks so much in advance