Re: Document -x and -vx give the same results

2021-11-14 Thread Dan Jacobson
I was testing -xeu vs. -vxeu on

set -xeu
set /var/lib/exim4/config.autogenerated
cp $@ /tmp
update-exim4.conf --verbose
diff /tmp $@||:
set update-exim4.conf.conf
echo . $PWD/$@-jidanni > /tmp/$@
diff $@ /tmp

and no matter STDOUT or STDERR they gave the same results, there in
emacs' *compilation* buffer.



Document -x and -vx give the same results

2021-11-14 Thread Dan Jacobson
Man page says:
   -vPrint shell input lines as they are read.
   -xPrint commands and their arguments as they are executed.
Perhaps mention that -x and -vx give the same results, often or always.
GNU bash, version 5.1.8



Re: help for needs to mention for ((...))

2021-09-19 Thread Dan Jacobson
OK, so it first looks for exact hits,
then does a grep style match.
And we see that

$ help f|grep :.
false: false
fc: fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]
fg: fg [job_spec]
for: for NAME [in WORDS ... ] ; do COMMANDS; done
for ((: for (( exp1; exp2; exp3 )); do COMMANDS; done
function: function name { COMMANDS ; } or name () { COMMANDS ; }

the function name is 'for (('
not 'for (( ))' etc.
Great.



Re: help for needs to mention for ((...))

2021-09-19 Thread Dan Jacobson
$ help f|wc -l
72
$ help fo   |wc -l
24
$ help for  |wc -l
10
$ help for\ |wc -l
14
$ help for\ \(  |wc -l
14
$ help for\ \(\(|wc -l
14

So help help's 'If PATTERN is specified, gives detailed help on all
commands matching PATTERN." is not telling the whole story about
matching.



Re: help for needs to mention for ((...))

2021-09-19 Thread Dan Jacobson
OK, then "help for" should at least mention that trick to get the rest of
the story.



help for needs to mention for ((...))

2021-09-19 Thread Dan Jacobson
$ help for
only mentions
   for name [ [ in [ word ... ] ] ; ] do list ; done
and needs to be updated to mention
   for (( expr1 ; expr2 ; expr3 )) ; do list ; done
$ echo $BASH_VERSION
5.1.8(1)-release



"command" help page

2021-08-20 Thread Dan Jacobson
$ help command | grep -i -- -v
  -vprint a description of COMMAND similar to the `type' builtin
  -Vprint a more verbose description of each COMMAND
$ command -v cat
/bin/cat
$ type cat
cat is /bin/cat
$ command -V cat
cat is /bin/cat

So it turns out -V is like type, not -v!

Also when you say "description" one expects something like:

$ man cat | col -b | grep -A 1 -i description
DESCRIPTION
   Concatenate FILE(s) to standard output.



Document that set -v inside case statements is special

2021-04-20 Thread Dan Jacobson
Please document on the man page somewhere that set -v, +v inside case
statements is special:
$ cat A
case x in x)
  set -v
  : B
  case y in y)
   set -v
   : Z
   ;;
  esac
  ;;
esac
: C
$ bash A
: C

I.e., -v and +v in case statements are remembered, but only have effects
after leaving all case statements. Unlike +x, -x. Same it turns out for dash(1).
Bash 5.1.4.



Document variable names need to be all ASCII

2021-04-19 Thread Dan Jacobson
$ e哈=1
bash: e哈=1: command not found
OK, but on man bash is it ever mentioned that a variable name must be all ASCII?

ENVIRONMENT
   When a program is invoked it is given an array of  strings  called  the
   environment.   This  is  a  list  of  name-value  pairs,  of  the  form
   name=value

PARAMETERS
   A parameter is an entity that stores values.  It can be a name, a  num‐
   ber, or one of the special characters listed below under Special Param‐
   eters.  A variable is a parameter denoted by a name.  A variable has ...



Say to use test -e in preference to test -a

2021-02-08 Thread Dan Jacobson
$ man bash #and
$ help test #say
  -a FILETrue if file exists.
  -e FILETrue if file exists.
OK, but add a note that it would be better to use -e,
as it is more portable.

Compare
$ test -a .
$ /usr/bin/test -a .



skip-completed-text "on" should be the default

2021-01-07 Thread Dan Jacobson
My experiments,
https://github.com/scop/bash-completion/issues/489
"prove" that
set skip-completed-text on
should be the default, not off.



bind documentation needs example for variables too, not just keys

2021-01-07 Thread Dan Jacobson
Man bash says

   Readline Variables
   Readline has variables that can be used to further customize its behav‐
   ior.  A variable may be set in the inputrc file with a statement of the
   form

  set variable-name value
   or using the bind builtin command (see SHELL BUILTIN COMMANDS below).

That's what I intend to do today. Use the bind command to set a variable.

OK, reading further, none of these

   bind [-m keymap] [-lpsvPSVX]
   bind [-m keymap] [-q function] [-u function] [-r keyseq]
   bind [-m keymap] -f filename
   bind [-m keymap] -x keyseq:shell-command
   bind [-m keymap] keyseq:function-name
   bind [-m keymap] keyseq:readline-command

Show how to set a readline variable.

  Display  current  readline key and function bindings, bind a key
  sequence to a readline function or  macro,  or  set  a  readline
  variable.  Each non-option argument is a command as it would ap‐
  pear in .inputrc, but each binding or command must be passed  as
  a separate argument; e.g., '"\C-x\C-r": re-read-init-file'.  Op‐
  tions, if supplied, have the following meanings:

OK, so the syntax is probably one of
$ bind set skip-completed-text on
or
$ bind skip-completed-text off

Yes, even after using

  -v Display  readline variable names and values in such a way
 that they can be re-read.
  -V List current readline variable names and values.

it is not clear. (But Junior (me) finally did figure it out below.)

Hmmm,
$ bind -v|wc -l
45
$ bind 
Display all 169 possibilities? (y or n)
$ bind set 
Display all 169 possibilities? (y or n)
45!=169

$ bind  -v|grep skip
set skip-completed-text off
$ bind skip-completed-text on
readline: skip-completed-text: no key sequence terminator
readline: on: no key sequence terminator
$ bind set skip-completed-text on
readline: : unknown variable name
readline: skip-completed-text: no key sequence terminator
readline: on: no key sequence terminator

$ help bind
bind: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r 
keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]

A glimmer of hope appears. Maybe "name" means variable. (It doesn't. So
really should be written [-q function-name] [-u function-name] as they
are below.)

Set Readline key bindings and variables.

Bind a key sequence to a Readline function or a macro, or set a
Readline variable.  The non-option argument syntax is equivalent to
that found in ~/.inputrc, but must be passed as a single argument:
e.g., bind '"\C-x\C-r": re-read-init-file'.

Wait! I see, I need to do
$ bind 'set skip-completed-text on'
$ bind  -v|grep skip
set skip-completed-text on
It worked!

Conclusions:

$ bind 'set 
should show those 45 completions!

And, the example
 bind '"\C-x\C-r": re-read-init-file'
is only for those (169) keys. Please add a second example, for those (45) 
variables:
 bind 'set skip-completed-text on'
Thanks!



Allow using a different completion pager

2021-01-07 Thread Dan Jacobson
$ man bash
   page-completions (On)
  If set to On, readline uses an internal more-like pager to  dis‐
  play a screenful of possible completions at a time.

OK, and it looks like:

final.target
first-boot-complete.target
fstrim.service
fstrim.timer
--More--


But if I could use less(1), then I could do
/nerbleblatz
string searches, etc.



Expand first before asking the question "Display all xxx possibilities?"

2020-08-02 Thread Dan Jacobson
Instead of

$ zz /jidanni_backups/da
Display all 113 possibilities? (y or n) n

and then finally showing

$ zz /jidanni_backups/dan_home_bkp

how about doing the expansion first, so entering
$ zz /jidanni_backups/da would then change into
$ zz /jidanni_backups/dan_home_bkp with below it the question
Display all 113 possibilities? (y or n)



Re: $ becomes \$ upon tab expansion

2020-05-25 Thread Dan Jacobson
OK, filed https://github.com/scop/bash-completion/issues/417 .



$ becomes \$ upon tab expansion

2020-05-24 Thread Dan Jacobson
$ ls $HOME/xx/yy/z
becomes
$ ls \$HOME/xx/yy/zz

It should become
$ ls $HOME/xx/yy/zz
else it will fail when the user finally hits RET.

(Assume a zz file already exists. "ls" here is just an example. same for
"cat" etc.) Bash 5.0.16



Re: Add non-interactive PROMPT_COMMAND

2020-03-11 Thread Dan Jacobson
> "AKK" == Andreas Kusalananda Kähäri  writes:
AKK> Does setting a DEBUG trap not do what you want? Such a trap would be
AKK> executed before each simple command...

OK! I guess it does! Thanks.



Add non-interactive PROMPT_COMMAND

2020-03-10 Thread Dan Jacobson
PROMPT_COMMAND=sleep\ 1 is great, it lets us slow down scripts...
but alas only if they are interactive.

One might say: "Sure, instead of
$ bash script
just use
$ sed 's/^/sleep 1; /' script | bash"

But that assumes one command per line, and could easily mangle things.

Instead bash simply needs a PROMPT_COMMAND that works non-interactively too.

Anyway, we could use it to e.g., "check how much oil we have left before
executing each command" etc. tons of great uses!

Maybe even have fullblown PRE and POST commands, that fire before and after 
each command.



unsetting non set items

2019-12-19 Thread Dan Jacobson
Man bash: "unset"
  if there is no variable by that name, any function with that name is unset.
Add:
  If there is no function by that name, nothing happens for that name.



Running 32 bit program on 64 bit system makes bash etc. look bad

2019-11-01 Thread Dan Jacobson
$ mapping/taipower/pole2tm
bash: mapping/taipower/pole2tm: No such file or directory

Must be a bash bug! Proof:
$ ls -l mapping/taipower/pole2tm
-rwxr-xr-x 1 jidanni jidanni 11290 2012-06-19  mapping/taipower/pole2tm

But wait,
$ strace mapping/taipower/pole2tm
execve("mapping/taipower/pole2tm", ["mapping/taipower/pole2tm"], 0x7ffd53416200 
/* 58 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++

Must also be a strace bug...

Ah,
$ file mapping/taipower/pole2tm
mapping/taipower/pole2tm: ELF 32-bit LSB executable...

but we are running it on
$ arch
x86_64

Anyway, perhaps somebody could submit a kernel bug, telling them to
somehow make bash, etc. look less bad, by a clearer error message, as I
suppose bash cannot always catch such cases, to make a better error
message.

In fact maybe bash could catch it (expensive?):

First "stat" the file.
If it doesn't exist bash should make its own message
bash: /tmp/abce: No such file or directory
If it does, then bash should be prepared to catch the kernel's message
(which is referring to a *different* file, which yes, actually does not exist.)
Whereupon bash could make a better error message.



Re: Idea: *.p completion

2019-09-01 Thread Dan Jacobson
CR> I'm saying that's what the default bash completion code does. The default
CR> bash completion code leaves the word unchanged.

Yes. That's why I'm saying wouldn't it be neat if it made
*.p into *.pdf? What harm could possibly happen?
The idea being if the user has handed it an asterisk,
then he wants that asterisk to still be in the result.



Re: Idea: *.p completion

2019-09-01 Thread Dan Jacobson
>>>>> "CR" == Chet Ramey  writes:
CR> On 9/1/19 11:10 AM, 積丹尼 Dan Jacobson wrote:
>> $ ls *.pdf
>> a.pdf  b.pdf
>> $ diff *.p
>> 
>> At this point  should complete "*.pdf".

CR> It does (well, the default completion does, maybe programmable completion
CR> for diff does too). But the two possible completions differ immediately --
CR> in the first character -- so what are you going to do? Rather than remove
CR> the word, as normal completion would do, the default bash completion leaves
CR> it alone.

I'm saying I want a real "* . p d f" as the result, I.e., genuine * 0x2A
asterisk left sitting upon the screen.

diff is just an example. Maybe use the generic ":" command instead.

(Yes I wish to disable /usr/share/bash-completion effects while testing,
though it is on by default in Debian.)

>> Or maybe as a bonus it could complete "a.pdf  b.pdf" via a different key.

CR> You want it to insert the possible completions? Use C-x* in emacs mode:

CR> glob-expand-word (C-x *)
CR>The word before point is  treated  as  a  pattern  for  pathname
CR>expansion,  and  the  list  of  matching  filenames is inserted,
CR>replacing the word.  If  a  numeric  argument  is  supplied,  an
CR>asterisk is appended before pathname expansion.

Well that can deal with "*" but not "*.p".



Idea: *.p completion

2019-09-01 Thread Dan Jacobson
$ ls *.pdf
a.pdf  b.pdf
$ diff *.p

At this point  should complete "*.pdf".

Or maybe as a bonus it could complete "a.pdf  b.pdf" via a different key.



mention bind when mentioning inputrc

2019-04-19 Thread Dan Jacobson
On the man page:

   Readline Variables

Readline has variables that can be used to further customize its
behavior. A variable may be set in the inputrc file with a
ADD:    ^or inspected with the bind command, or 
set 
statement of the form

  set variable-name value




Maybe implement emacs' previous-history-element

2019-03-02 Thread Dan Jacobson
All I know is in emacs,
let's say we did
^Rgrandma this morning,
and in the afternoon we did
^Rgrandpa.

Well we could do ^R^R to search for grandpa again, and for grandma we
could employ ^R then
> M-p (translated from  p) runs the command
> previous-history-element (found in minibuffer-local-isearch-map),
so maybe readline could benefit from something like that.
Also see emacs' next-history-element.

Of course the name would need to be changed to previous-search or something.



Add warning on test -a, -o documentation

2019-02-13 Thread Dan Jacobson
On the bash man page at
  expr1 -a expr2
 True if both expr1 and expr2 are true.
  expr1 -o expr2
 True if either expr1 or expr2 is true.
and on "help test" perhaps add the same warning as one sees on
(info "(coreutils) Connectives for test").



Re: ${p+\"$p\"}

2019-01-22 Thread Dan Jacobson
OK so bash is right and dash is wrong? So I should file a dash bug?



$PS5, for sh -v!

2018-04-03 Thread Dan Jacobson
$PS4 is for sh -x. Well, $PS5 or $PSv should be for sh -v!

Imagine, with just a simple PS5='$ ', one could produce
perfect dialogues,

$ set -eu /tmp/x
$ mkdir $@
$ cd $@
$ seq 3|xargs touch
$ ls -U $@
3  2  1
$ mv -v $@ /var$@
created directory '/var/tmp/x'
copied '/tmp/x/1' -> '/var/tmp/x/1'
copied '/tmp/x/2' -> '/var/tmp/x/2'
copied '/tmp/x/3' -> '/var/tmp/x/3'
removed '/tmp/x/3'
removed '/tmp/x/2'
removed '/tmp/x/1'
removed directory '/tmp/x'
$ ls -U /var$@
3  1  2
$ rm -vr /var$@
removed '/var/tmp/x/3'
removed '/var/tmp/x/1'
removed '/var/tmp/x/2'
removed directory '/var/tmp/x'

all ready for the classroom, or textbook publisher, instead of just a jumbled

set -eu /tmp/x
mkdir $@
cd $@
seq 3|xargs touch
ls -U $@
3  2  1
mv -v $@ /var$@
created directory '/var/tmp/x'
copied '/tmp/x/1' -> '/var/tmp/x/1'
copied '/tmp/x/2' -> '/var/tmp/x/2'
copied '/tmp/x/3' -> '/var/tmp/x/3'
removed '/tmp/x/3'
removed '/tmp/x/2'
removed '/tmp/x/1'
removed directory '/tmp/x'
ls -U /var$@
3  1  2
rm -vr /var$@
removed '/var/tmp/x/3'
removed '/var/tmp/x/1'
removed '/var/tmp/x/2'
removed directory '/var/tmp/x'

when using this script,

PS5='$ '
set -v
set -eu /tmp/x
mkdir $@
cd $@
seq 3|xargs touch
ls -U $@
mv -v $@ /var$@
ls -U /var$@
rm -vr /var$@

In fact $PS5 could even be dynamically expanded just like some other $PS's.



Re: help complete: mention remove all AND restore all

2017-11-10 Thread Dan Jacobson
> "EB" == Eduardo Bustamante  writes:

EB> I googled "disable programmable completion bash" and the first result

I was just googling for disable bash completion.

That's how confusing it is for most users.



Re: help shopt: mention what happens if only optnames are given

2017-11-05 Thread Dan Jacobson
OK it mentions "Without any option arguments". Then it also needs to
mention "Without any argument at all".



help shopt: mention what happens if only optnames are given

2017-11-05 Thread Dan Jacobson
$ help shopt
shopt: shopt [-pqsu] [-o] [optname ...]
Set and unset shell options.

Change the setting of each shell option OPTNAME.  Without any option
arguments, list all shell options with an indication of whether or not each
is set.

Add:
If just optnames are given, list each's status.



Re: help complete: mention remove all AND restore all

2017-11-05 Thread Dan Jacobson
OK, please on
$ help complete
at "-r" please mention
"To instead toggle on and off PROGRAMMABLE completion, use shopt -[su] 
progcomp."

Reason: there is very little chance the user could Google the right
answer out of the forest of answers out there.

(P.S., I am not sure if PROGRAMMABLE should be in caps, to distinguish
it from all the other kinds of completion.)



Re: help complete: mention remove all AND restore all

2017-11-05 Thread Dan Jacobson
PG> There is no magic way to restore them

Actually it also says
  -pprint existing completion specifications in a reusable format
So maybe it should say do
   I=$(completion -p); completion -r; : your tests; $I
but I didn't test it.



Re: variables not TAB expanded except in first position

2017-11-05 Thread Dan Jacobson
OK submitted https://github.com/scop/bash-completion/issues/173



help complete: mention remove all AND restore all

2017-11-05 Thread Dan Jacobson
$ help complete

  -rremove a completion specification for each NAME, or, if no
NAMEs are supplied, all completion specifications

Add
To later restore them do ...

as one often wants to remove them all, try something, and then put them
all back.

I am not asking for help. I am saying $ help complete should mention
more things.



variables not TAB expanded except in first position

2017-11-05 Thread Dan Jacobson
$ $BRO #makes $BROWSER. Good!
$ xargs $BRO #just beeps. Bad.
Yes I have bash-completions installed but am not sure what is to blame.



Re: ulimit -c unlimited

2017-07-26 Thread Dan Jacobson
CR> The third command attempts to increase the limit beyond the current hard
CR> limit. If you're not root, this is not permitted.

I find it odd that a normal user can raise it only once...



Re: ulimit -c unlimited

2017-07-26 Thread Dan Jacobson
$  ulimit -c
0
$  ulimit -c 99
$  ulimit -c
99
$  ulimit -c 99
bash: ulimit: 99: limit out of range
$  ulimit -c 999
bash: ulimit: 999: limit out of range
$  ulimit -c 999
bash: ulimit: 999: limit out of range

Hmmm, maybe make the above error message say what the range is, so the
user doesn't have to probe it. Or say "do ... to see the valid range".


$  ulimit -c 9
bash: ulimit: core file size: cannot modify limit: Operation not permitted
$  ulimit -c 99
bash: ulimit: core file size: cannot modify limit: Operation not permitted
$  ulimit -c 99
bash: ulimit: core file size: cannot modify limit: Operation not permitted

By this time the user has probably given up... thinking that it isn't
the value that is the problem, but the basic Operation. (But if he
probes further, indeed some values work.)

$  ulimit -c 99
$  ulimit -c 999
bash: ulimit: core file size: cannot modify limit: Operation not permitted

Odd, a little later I try
$ ulimit -c 99
bash: ulimit: core file size: cannot modify limit: Operation not permitted

> "R" == Reuti   writes:

R> Do you get this as root too?

I'm just trying to say the messages are confusing for the normal user.
I don't want make my report too big, so am not trying it for root.

R> If the hard limit is unlimited, then you can raise the soft limit
R> again also as normal user to be unlimited. So the statement "Operation
R> not permitted" is correct, although it means: "can't raise hard limit
R> again" as without -S or -H it sets both limits. The soft limit OTOH
R> can be changed between a value and unlimited as often as you like, as
R> the long as the hard limit stays to be set to unlimited.

Hmmm...Wait... I was using "help ulimit",
now I see on the bash man page

  The -H and -S options specify that the hard or soft limit is set
  for the given resource.  A hard limit cannot be increased  by  a
  non-root  user  once it is set; a soft limit may be increased up
  to the value of the hard limit.

So maybe that explains why the user can only set it once (99 above) then
cannot change it...

OK I recommend the "help ulimit" now say

  [-S|-H] -aall current limits are reported
  [-S|-H] -bthe socket buffer size
  [-S|-H] -cthe maximum size of core files created
  [-S|-H] -dthe maximum size of a process's data segment
  [-S|-H] -ethe maximum scheduling priority (`nice')
  [-S|-H] -fthe maximum size of files written by the shell and its 
children

and perhaps the same on the bash man page.



Re: expand x*y concludes with one

2017-06-25 Thread Dan Jacobson
OK I submitted
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865875
against bash-completion.



Re: expand x*y concludes with one

2017-06-23 Thread Dan Jacobson
$ apt-cache policy bash bash-completion
bash:
  Installed: 4.4-5 ...
bash-completion:
  Installed: 1:2.1-4.3 ...
OK
$ INPUTRC=/dev/null bash
$ : k*m
kam  kaam kam

OK I suppose I should report a bug against the bash-completion package.



expand x*y concludes with one

2017-06-23 Thread Dan Jacobson
# su - nobody
$ touch kam kaam kam
$ : k*m #becomes:
$ : kam
$ sh
sh-4.4$ : k*m #does a better job it seems:
kam  kaam kam
sh-4.4$ : k*m



CTRL-R RET "morning after pill" keystroke

2017-05-14 Thread Dan Jacobson
New idea: you've searched way back in history (^R), found what you want,
and hit RET, only to realize that you really wanted to hit ^O.

Well now you have to search all over again (^R) and then hit ^N to get
the same effect.

Well perhaps there could be a "morning after pill" keystroke added. Bash
could always remember the last search position (not just last search
string), just in case one needed it... and have it bound to some key.



Re: echo x > a > b > c > d

2017-04-16 Thread Dan Jacobson
OK. (But shellcheck doesn't catch it either.)
$ { echo '#!/bin/sh'; echo 'echo x > c > c > c';}|shellcheck /dev/stdin
$ { echo '#!/bin/sh'; echo 'echo x < c < c < c';}|shellcheck /dev/stdin



Re: echo x > a > b > c > d

2017-04-16 Thread Dan Jacobson
OK sorry. I guess they make a lot of sense.



echo x > a > b > c > d

2017-04-16 Thread Dan Jacobson
Maybe bash should catch this
$ echo x > a > b > c > d
and print a warning.
Same with
$ cat < a < b < c < d



Re: history vs. poweroff

2017-01-31 Thread Dan Jacobson
GW> Log out, log back in as root, issue the command, and accept that root's
GW> (very short) shell history will be lost.

Well mention that on the man page.
I.e., the man page should address the paradox of saving a complete
history vs. being able to turn off one's computer.



Re: history vs. poweroff

2017-01-31 Thread Dan Jacobson
GW> I'm confused.  You don't logout before shutting down your computer?
GW> I would strongly recommend doing so, unless it's an emergency.

All I know is I want to issue one command to turn off the computer.
If I logged off first, how could I issue that (poweroff(8)) command?

OK you people turn off your computers by pressing buttons. I see. It is
my problem.



history vs. poweroff

2017-01-30 Thread Dan Jacobson
Man page says:
 When a shell with history enabled exits...

 and

 The shell exits by default upon receipt of a SIGHUP...

However on slower systems, at the end of the day when the user issues
the poweroff(8) command, all this might not complete, resulting in the
entire day's of history getting thrown away.

So perhaps on the man page add a word of caution.

I even had to write a batch(1) script to stop (killall -1) my shells,
then X-Windows, then finally poweroff. (a simple nohup script wasn't
enough.)

(But doing export PROMPT_COMMAND='history -a' is overkill).



help vs. partial option lists

2017-01-03 Thread Dan Jacobson
$ help complete
...
Options:
  -pprint existing completion specifications in a reusable format
  -rremove a completion specification for each NAME, or, if no
NAMEs are supplied, all completion specifications
  -Dapply the completions and actions as the default for commands
without any specific completion defined
  -Eapply the completions and actions to "empty" commands --
completion attempted on a blank line

I would say 'Option highlights / Some Options / Selected Options' as that is 
not a full list.



Re: run_readline_command to avoid the bother of binding something

2016-09-18 Thread Dan Jacobson
OK then please add

   dump-functions
  Print all of the functions and their key bindings to  the  read-
  line output stream.  If a numeric argument is supplied, the out-
  put is formatted in such a way that it can be made  part  of  an
  inputrc file.

"See also bind -P, -p"



   dump-variables
  Print all of the settable readline variables and their values to
  the readline output stream.  If a numeric argument is  supplied,
  the  output  is formatted in such a way that it can be made part
  of an inputrc file.

"See also bind -V, -v"



   dump-macros
  Print all of the readline key sequences bound to macros and  the
  strings  they  output.   If  a numeric argument is supplied, the
  output is formatted in such a way that it can be made part of an
  inputrc file.

"See also bind -M, -m"


Also at

   Readline Variables
   Readline has variables that can be used to further customize its behav-
   ior.  A variable may be set in the inputrc file with a statement of the
   form

  set variable-name value

   Except  where  noted,  readline variables can take the values On or Off
   (without regard to case).  Unrecognized  variable  names  are  ignored.
   When  a variable value is read, empty or null values, "on" (case-insen-

do remind the user (please yet) again that he can check their current value with
bind -v, -V.

And, as

http://unix.stackexchange.com/questions/27471/setting-readline-variables-in-the-shell

mentions also remind him,

'You can make bash execute readline commands through the bind builtin:

bind "set var value"'

i.e., inputrc is not the only choice.

Thanks.



undocumented 'prefer-visible-bell' found in /bin/bash

2016-09-17 Thread Dan Jacobson
$ strings /bin/bash | grep -c prefer-visible-bell
1
$ man bash | grep -c prefer-visible-bell
0
$ find /usr/share/doc/bash* -type f | xargs zgrep prefer-visible-bell | wc -l
0



Re: why must bash zap last search string just because we hit ^C?

2015-10-20 Thread Dan Jacobson
> Press Ctrl-u
OK I see this also works for
$ ^Rabcdefg^U
$ some command the boss told me to do
$ ^R^R
and voila! I am back to searching "abcdefg" again.
OK, I'll remember ^U. Case closed. Thanks everybody.



Re: why must bash zap last search string just because we hit ^C?

2015-10-17 Thread Dan Jacobson
> "CFAJ" == Chris F A Johnson  writes:

CFAJ>   ^Z then fg

^Rsearch_string^Z^Z^Z^Z
the ^Z's are ignored. I can't get back to a prompt with ^Z.



Re: why must bash zap last search string just because we hit ^C?

2015-10-17 Thread Dan Jacobson
> "DR" == Dave Rutherford  writes:

DR> Can you run gnu screen? ^A-c will get you a new shell session in the
DR> existing terminal emulator (it will use a new terminal device, though,
DR> if that's what you care about.)

Let's pretend that I am on a gunk device on a gunk OS and all I have to
work with is this one shell and I just want to back out of my search
peacefully and resume it later with minimal ado. OK I will do ESC ESC #.



Re: why must bash zap last search string just because we hit ^C?

2015-10-17 Thread Dan Jacobson
DW> On Fri, Oct 16, 2015 at 1:50 PM, Chet Ramey  wrote:

DW> ^C rudely aborts the entire operation.  Why assume you want to save any
DW> of the context?

Because I got a phone call: the boss asked me to execute a shell
command. I used ^C to get myself back to a prompt so I could type in the
command. Now I want to resume searching and must type my
^Rlong_search_string all over again.
OK I suppose I can train myself to do ^A # RET or ESC ESC # instead.



Re: why must bash zap last search string just because we hit ^C?

2015-10-17 Thread Dan Jacobson
> "CFAJ" == Chris F A Johnson  writes:

CFAJ> Or just press UP (as many times as necessary) and RET.

That won't get me to a $ prompt.
I want to suspend my search and resume it later.



Re: why must bash zap last search string just because we hit ^C?

2015-10-17 Thread Dan Jacobson
> "DW" == Dennis Williamson  writes:

DW> Or just open a new terminal rather than interrupting an in-progress search.

I am on a device where opening a new terminal is a lot of trouble.



why must bash zap last search string just because we hit ^C?

2015-10-16 Thread Dan Jacobson
Type ^Racb^C^R^R
(Search backwards for abc, then hit ^C, then try searching backwards
some more using the last search string.)

My problem is why must bash zap the memory of abc just because we hit ^C?



Re: make first different character bold when showing completions ala emacs

2015-10-11 Thread Dan Jacobson
> "CR" == Chet Ramey  writes:

CR> There is an option in readline-7.0 that will cause completion to display
CR> the common prefix of a set of possible completions in a distinctive
CR> color.  This has essentially the same visual effect.

OK. I see http://packages.debian.org/readline-common is only at 6.3 yet.
(Hope that option is turned on by default when it hits Debian. Else I
won't remember to turn it on.)



make first different character bold when showing completions ala emacs

2015-10-09 Thread Dan Jacobson
# dpkg -i /var/cache/apt/archives/phpmyadmin_4%3a4. shows
phpmyadmin_4%3a4.4.15-1_all.deb   phpmyadmin_4%3a4.5.0.2-2_all.deb
# dpkg -i /var/cache/apt/archives/phpmyadmin_4%3a4.

Can you please make the first different character bold, like emacs does,

Possible completions are:
phpmyadmin_4%3a4.4.15-1_all.deb
phpmyadmin_4%3a4.5.0.2-2_all.deb

(You can't see the bold in this ASCII email, but it is there.)

In fact we see that if you line them up vertically in one column, it
also helps a lot!



add argument to help history

2014-10-23 Thread Dan Jacobson
$ help history
  -d offset delete the history entry at offset OFFSET.
  -aappend history lines from this session to the history file
  -nread all history lines not already read from the history file
  -rread the history file and append the contents to the history 
list
  -wwrite the current history to the history file and append them 
to the history list

Item -d above lists its argument but the others don't. The others should
say
  -a [filename] append history lines from this session to the history file
  -n [filename] read all history lines not already read from the history 
file
  -r [filename] read the history file and append the contents to the 
history list
  -w [filename] write the current history to the history file and append 
them to the history list



Display all 132 possibilities? (y, n, or t) t=time!

2014-06-14 Thread Dan Jacobson
Super duper idea: you know when we hit TAB and it says
Display all 132 possibilities? (y or n)

Well, that happens to be the 'ls -a' format it is asking about.

Well, who says that is the most natural format or the format we want at
that time?

What if occasionally we want the 'ls -t' or 'ls -ta' format?

Well, it would be nice to have it ask instead
Display all 132 possibilities? (y, n, or t)

But wait, what if there are not so many completions to trigger the question?
(Well, in that case one could say that alphabetical order is OK as it
isn't that difficult to find what one is looking for among so few items.)

Anyway, one might remove in alphabetical order from

   print-completions-horizontally (Off)
  If  set  to  On,  readline will display completions with matches
  sorted horizontally in alphabetical order, rather than down  the
  screen.

as in the future that might not always be the case!

Anyway, in addition to t for time, there could be r for reverse. (But no
rt or tr as it should act on the first character it reads.)



'help' command adds unnecessary trailing blanks indenting empty lines

2014-05-03 Thread Dan Jacobson
No big deal but,
$ help :|cat -e
:: :$
Null command.$
$
No effect; the command does nothing.$
$
Exit Status:$
Always succeeds.$