Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Invest in physics -- own a piece of Dirac!


devel / comp.unix.shell / The strange syntax for shell shortcut binding with bind command.

SubjectAuthor
* The strange syntax for shell shortcut binding with bind command.hongy...@gmail.com
`* Re: The strange syntax for shell shortcut binding with bind command.Janis Papanagnou
 `* Re: The strange syntax for shell shortcut binding with bind command.hongy...@gmail.com
  `* Re: The strange syntax for shell shortcut binding with bind command.Janis Papanagnou
   `* Re: The strange syntax for shell shortcut binding with bind command.hongy...@gmail.com
    `* Re: The strange syntax for shell shortcut binding with bind command.Janis Papanagnou
     `- Re: The strange syntax for shell shortcut binding with bind command.Josef Moellers

1
The strange syntax for shell shortcut binding with bind command.

<b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4277&group=comp.unix.shell#4277

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ae9:f70e:: with SMTP id s14mr21349835qkg.38.1630289347084; Sun, 29 Aug 2021 19:09:07 -0700 (PDT)
X-Received: by 2002:a0c:a709:: with SMTP id u9mr3426593qva.3.1630289346962; Sun, 29 Aug 2021 19:09:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 29 Aug 2021 19:09:06 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=60.249.28.127; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 60.249.28.127
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>
Subject: The strange syntax for shell shortcut binding with bind command.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 30 Aug 2021 02:09:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 15
 by: hongy...@gmail.com - Mon, 30 Aug 2021 02:09 UTC

I use hstr [1] to view, navigate, search and manage my command history, which uses the following keyboard shortcut binding:

$ bind -S
\C-r outputs \C-a hstr -- \C-j
\C-xk outputs \C-a hstr -k \C-j

I've checked the built-in help of bind command, but still don’t understand how these keyboard shortcuts work.

Any more hints will be highly appreciated.

[1] https://github.com/dvorka/hstr

Regards,
HY

Re: The strange syntax for shell shortcut binding with bind command.

<sghg1j$2gl$1@news-1.m-online.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4280&group=comp.unix.shell#4280

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: The strange syntax for shell shortcut binding with bind command.
Date: Mon, 30 Aug 2021 04:33:23 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 20
Message-ID: <sghg1j$2gl$1@news-1.m-online.net>
References: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>
NNTP-Posting-Host: 2001:a61:2431:ec01:c81:4b40:212d:333a
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: news-1.m-online.net 1630290803 2581 2001:a61:2431:ec01:c81:4b40:212d:333a (30 Aug 2021 02:33:23 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Mon, 30 Aug 2021 02:33:23 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
In-Reply-To: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>
 by: Janis Papanagnou - Mon, 30 Aug 2021 02:33 UTC

You should mention that you are asking for a _bash_ specific 'bind'
function. - Doesn't the bash man page explains it?

On 30.08.2021 04:09, hongy...@gmail.com wrote:
> I use hstr [1] to view, navigate, search and manage my command history, which uses the following keyboard shortcut binding:
>
> $ bind -S
> \C-r outputs \C-a hstr -- \C-j
> \C-xk outputs \C-a hstr -k \C-j
>
> I've checked the built-in help of bind command, but still don’t understand how these keyboard shortcuts work.
>
> Any more hints will be highly appreciated.
>
> [1] https://github.com/dvorka/hstr
>
> Regards,
> HY
>

Re: The strange syntax for shell shortcut binding with bind command.

<5f3f1ef1-59be-4029-9713-a532a0ed9410n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4282&group=comp.unix.shell#4282

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:620a:2298:: with SMTP id o24mr20282733qkh.235.1630291658898;
Sun, 29 Aug 2021 19:47:38 -0700 (PDT)
X-Received: by 2002:a05:620a:2849:: with SMTP id h9mr20495184qkp.69.1630291658762;
Sun, 29 Aug 2021 19:47:38 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 29 Aug 2021 19:47:38 -0700 (PDT)
In-Reply-To: <sghg1j$2gl$1@news-1.m-online.net>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.116; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.116
References: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com> <sghg1j$2gl$1@news-1.m-online.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5f3f1ef1-59be-4029-9713-a532a0ed9410n@googlegroups.com>
Subject: Re: The strange syntax for shell shortcut binding with bind command.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 30 Aug 2021 02:47:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Mon, 30 Aug 2021 02:47 UTC

On Monday, August 30, 2021 at 10:33:27 AM UTC+8, Janis Papanagnou wrote:
> You should mention that you are asking for a _bash_ specific 'bind'
> function. - Doesn't the bash man page explains it?

Yes. There are some explanations in bash man page:

###################
$ 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]
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'.

Options:
-m keymap Use KEYMAP as the keymap for the duration of this
command. Acceptable keymap names are emacs,
emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
vi-command, and vi-insert.
-l List names of functions.
-P List function names and bindings.
-p List functions and bindings in a form that can be
reused as input.
-S List key sequences that invoke macros and their values
-s List key sequences that invoke macros and their values
in a form that can be reused as input.
-V List variable names and values
-v List variable names and values in a form that can
be reused as input.
-q function-name Query about which keys invoke the named function.
-u function-name Unbind all keys which are bound to the named function.
-r keyseq Remove the binding for KEYSEQ.
-f filename Read key bindings from FILENAME.
-x keyseq:shell-command Cause SHELL-COMMAND to be executed when
KEYSEQ is entered.
-X List key sequences bound with -x and associated commands
in a form that can be reused as input.

Exit Status:
bind returns 0 unless an unrecognized option is given or an error occurs.
###################

But I've previously checked the following:

$ man bind

BIND(2) Linux Programmer's Manual BIND(2)

NAME
bind - bind a name to a socket

Regards,
HY

> On 30.08.2021 04:09, hongy...@gmail.com wrote:
> > I use hstr [1] to view, navigate, search and manage my command history, which uses the following keyboard shortcut binding:
> >
> > $ bind -S
> > \C-r outputs \C-a hstr -- \C-j
> > \C-xk outputs \C-a hstr -k \C-j
> >
> > I've checked the built-in help of bind command, but still don’t understand how these keyboard shortcuts work.
> >
> > Any more hints will be highly appreciated.
> >
> > [1] https://github.com/dvorka/hstr
> >
> > Regards,
> > HY
> >

Re: The strange syntax for shell shortcut binding with bind command.

<sghjfm$3fr$1@news-1.m-online.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4283&group=comp.unix.shell#4283

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: The strange syntax for shell shortcut binding with bind command.
Date: Mon, 30 Aug 2021 05:32:06 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 32
Message-ID: <sghjfm$3fr$1@news-1.m-online.net>
References: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>
<sghg1j$2gl$1@news-1.m-online.net>
<5f3f1ef1-59be-4029-9713-a532a0ed9410n@googlegroups.com>
NNTP-Posting-Host: 2001:a61:2431:ec01:c81:4b40:212d:333a
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1630294326 3579 2001:a61:2431:ec01:c81:4b40:212d:333a (30 Aug 2021 03:32:06 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Mon, 30 Aug 2021 03:32:06 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
In-Reply-To: <5f3f1ef1-59be-4029-9713-a532a0ed9410n@googlegroups.com>
 by: Janis Papanagnou - Mon, 30 Aug 2021 03:32 UTC

On 30.08.2021 04:47, hongy...@gmail.com wrote:
> On Monday, August 30, 2021 at 10:33:27 AM UTC+8, Janis Papanagnou wrote:
>> You should mention that you are asking for a _bash_ specific 'bind'
>> function. - Doesn't the bash man page explains it?
>
> Yes. There are some explanations in bash man page:
>
> ###################
> $ 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]
> Set Readline key bindings and variables.
>[...]
> ###################
>
> But I've previously checked the following:
>
> $ man bind
>
> BIND(2) Linux Programmer's Manual BIND(2)
>
> NAME
> bind - bind a name to a socket

This is obviously something completely different. Type

man man

to see what you find in the various man page sections. Don't expect
that you find 'bash' functions in the Unix system calls section (2)!

Janis

Re: The strange syntax for shell shortcut binding with bind command.

<9079fd51-7515-4283-be29-e177e3ffa612n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4288&group=comp.unix.shell#4288

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:1207:: with SMTP id y7mr19602795qtx.146.1630299491229;
Sun, 29 Aug 2021 21:58:11 -0700 (PDT)
X-Received: by 2002:ae9:e407:: with SMTP id q7mr20957095qkc.55.1630299491097;
Sun, 29 Aug 2021 21:58:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 29 Aug 2021 21:58:10 -0700 (PDT)
In-Reply-To: <sghjfm$3fr$1@news-1.m-online.net>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.125; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.125
References: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>
<sghg1j$2gl$1@news-1.m-online.net> <5f3f1ef1-59be-4029-9713-a532a0ed9410n@googlegroups.com>
<sghjfm$3fr$1@news-1.m-online.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9079fd51-7515-4283-be29-e177e3ffa612n@googlegroups.com>
Subject: Re: The strange syntax for shell shortcut binding with bind command.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 30 Aug 2021 04:58:11 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Mon, 30 Aug 2021 04:58 UTC

On Monday, August 30, 2021 at 11:32:10 AM UTC+8, Janis Papanagnou wrote:
> On 30.08.2021 04:47, hongy...@gmail.com wrote:
> > On Monday, August 30, 2021 at 10:33:27 AM UTC+8, Janis Papanagnou wrote:
> >> You should mention that you are asking for a _bash_ specific 'bind'
> >> function. - Doesn't the bash man page explains it?
> >
> > Yes. There are some explanations in bash man page:
> >
> > ###################
> > $ 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]
> > Set Readline key bindings and variables.
> >[...]
> > ###################
> >
> > But I've previously checked the following:
> >
> > $ man bind
> >
> > BIND(2) Linux Programmer's Manual BIND(2)
> >
> > NAME
> > bind - bind a name to a socket
> This is obviously something completely different. Type
>
> man man
>
> to see what you find in the various man page sections. Don't expect
> that you find 'bash' functions in the Unix system calls section (2)!

What do you mean by saying ``(2)! '' here?
> Janis

Re: The strange syntax for shell shortcut binding with bind command.

<sgi9mu$9n3$1@news-1.m-online.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4289&group=comp.unix.shell#4289

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: The strange syntax for shell shortcut binding with bind command.
Date: Mon, 30 Aug 2021 11:51:25 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 82
Message-ID: <sgi9mu$9n3$1@news-1.m-online.net>
References: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>
<sghg1j$2gl$1@news-1.m-online.net>
<5f3f1ef1-59be-4029-9713-a532a0ed9410n@googlegroups.com>
<sghjfm$3fr$1@news-1.m-online.net>
<9079fd51-7515-4283-be29-e177e3ffa612n@googlegroups.com>
NNTP-Posting-Host: 2001:a61:2431:ec01:c81:4b40:212d:333a
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1630317086 9955 2001:a61:2431:ec01:c81:4b40:212d:333a (30 Aug 2021 09:51:26 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Mon, 30 Aug 2021 09:51:26 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <9079fd51-7515-4283-be29-e177e3ffa612n@googlegroups.com>
 by: Janis Papanagnou - Mon, 30 Aug 2021 09:51 UTC

On 30.08.2021 06:58, hongy...@gmail.com wrote:
> On Monday, August 30, 2021 at 11:32:10 AM UTC+8, Janis Papanagnou wrote:
>> On 30.08.2021 04:47, hongy...@gmail.com wrote:
>>> On Monday, August 30, 2021 at 10:33:27 AM UTC+8, Janis Papanagnou wrote:
>>>> You should mention that you are asking for a _bash_ specific 'bind'
>>>> function. - Doesn't the bash man page explains it?
>>>
>>> Yes. There are some explanations in bash man page:
>>>
>>> ###################
>>> $ 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]
>>> Set Readline key bindings and variables.
>>> [...]
>>> ###################
>>>
>>> But I've previously checked the following:
>>>
>>> $ man bind
>>>
>>> BIND(2) Linux Programmer's Manual BIND(2)
>>>
>>> NAME
>>> bind - bind a name to a socket
>> This is obviously something completely different. Type
>>
>> man man
>>
>> to see what you find in the various man page sections. Don't expect
>> that you find 'bash' functions in the Unix system calls section (2)!
>
> What do you mean by saying ``(2)! '' here?

The exclamation mark is a regular grammatical punctuation character to
terminate the sentence. The number (2) is a manual page section number.
The man pages are separated in sections. You see that number e.g. above
in: "BIND(2) Linux Programmer's Manual BIND(2)"

You find (as already said) a list when calling the man page of 'man'
man man

....
The table below shows the section numbers of the manual followed by the
types of pages they contain.

1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and
conventions), e.g.
man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
....

Section 1 has what you typically call as commands from the shell.
Section 2 has what you typically call as system function in C programs.

The man command will show the first matching section. If you want to
get the command from another section call it with an explicit number.
Compare the output of
man link
man 1 link
man 2 link

Try, for example,
man passwd
and inspect the "see also" references on the bottom of the page where
you see the section numbers of the respective ressources

SEE ALSO
passwd(5), shadow(5), usermod(8).

then type
man 5 passwd
to find information about the file formats.

Janis

Re: The strange syntax for shell shortcut binding with bind command.

<ip42ifFgl1bU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4290&group=comp.unix.shell#4290

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: josef.mo...@invalid.invalid (Josef Moellers)
Newsgroups: comp.unix.shell
Subject: Re: The strange syntax for shell shortcut binding with bind command.
Date: Mon, 30 Aug 2021 14:51:27 +0200
Lines: 30
Message-ID: <ip42ifFgl1bU1@mid.individual.net>
References: <b663ec36-6f22-4eb0-83f8-fab962747590n@googlegroups.com>
<sghg1j$2gl$1@news-1.m-online.net>
<5f3f1ef1-59be-4029-9713-a532a0ed9410n@googlegroups.com>
<sghjfm$3fr$1@news-1.m-online.net>
<9079fd51-7515-4283-be29-e177e3ffa612n@googlegroups.com>
<sgi9mu$9n3$1@news-1.m-online.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net ObBzHXF1/KDyyRH6ZeZJrAEh2NpaOOXDWlmUe4CQIgv2VzQ+Qx
Cancel-Lock: sha1:BfA3ECSV7xmwtROI4vh1D3/1tQI=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
In-Reply-To: <sgi9mu$9n3$1@news-1.m-online.net>
Content-Language: en-US
 by: Josef Moellers - Mon, 30 Aug 2021 12:51 UTC

On 30.08.21 11:51, Janis Papanagnou wrote:

Just to be nitpicking, as I have been bitten by this (really badly!):

> You find (as already said) a list when calling the man page of 'man'
> man man
>
> ...
> The table below shows the section numbers of the manual followed by the
> types of pages they contain.
>
> 1 Executable programs or shell commands
> 2 System calls (functions provided by the kernel)

These *used to be* "functions provided by the kernel". While there still
is a *system call" "sys_open", the "open(2)" function is now often
implemented through the system call "sys_openat":
"Since version 2.26, the glibc wrapper function for open() employs the
openat() system call, rather than the kernel's open() system call. For
certain architectures, this is also true in glibc versions before 2.26."
[man 2 open]

This may be important when you eg want to block open(2) system calls
through systemd or you want to explicitly trace open(2) calls with
strace and you wonder why this does not work.

In a nutshell: do not rely on the fact that the function is described in
manual section 2!

Josef

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor