all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Backticks in Eshell
@ 2021-09-30  6:35 Felix E. Klee
  2021-09-30  7:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Felix E. Klee @ 2021-09-30  6:35 UTC (permalink / raw)
  To: help-gnu-emacs

To generate a one time password, I would do in Bash:

    oathtool -b --totp `gpg -d secret.gpg`

How do I do the equivalent in Eshell?

I tried:

    oathtool -b --totp ${gpg -d secret.gpg}

But that doesn’t work.  Even the following doesn’t work:

    echo ${gpg -h}

I expect GnuPG’s help text, but there’s no output.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30  6:35 Backticks in Eshell Felix E. Klee
@ 2021-09-30  7:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-30 13:19   ` Felix E. Klee
  2021-09-30  8:45 ` Using oathtool in Emacs - was " Jean Louis
  2021-09-30 13:38 ` Joost Kremers
  2 siblings, 1 reply; 11+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-30  7:26 UTC (permalink / raw)
  To: help-gnu-emacs

Felix E. Klee wrote:

> To generate a one time password, I would do in Bash:
>
>     oathtool -b --totp `gpg -d secret.gpg`

Probably one should use the $(subshell) syntax and not
`backticks` these days ...

  oathtool -b --totp $(gpg -d secret.gpg)

> How do I do the equivalent in Eshell?

I don't know but I think he (Jean) meant Elisp, not
Eshell - that's what he wrote anyway (Emacs Lisp).

And in Elisp I think one would use `shell-command' :)

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Using oathtool in Emacs - was Re: Backticks in Eshell
  2021-09-30  6:35 Backticks in Eshell Felix E. Klee
  2021-09-30  7:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-30  8:45 ` Jean Louis
  2021-09-30 13:38 ` Joost Kremers
  2 siblings, 0 replies; 11+ messages in thread
From: Jean Louis @ 2021-09-30  8:45 UTC (permalink / raw)
  To: Felix E. Klee; +Cc: help-gnu-emacs

* Felix E. Klee <felix.klee@inka.de> [2021-09-30 10:07]:
> To generate a one time password, I would do in Bash:
> 
>     oathtool -b --totp `gpg -d secret.gpg`
> 
> How do I do the equivalent in Eshell?
> 
> I tried:
> 
>     oathtool -b --totp ${gpg -d secret.gpg}
> 
> But that doesn’t work.  Even the following doesn’t work:
> 
>     echo ${gpg -h}
> 
> I expect GnuPG’s help text, but there’s no output.

I understand what you mean, but personally I don't keep it a secret in
my $HOME directory:

- all of the /home is encrypted, and I decrypt it manually when
  starting a computer. I do not let it to operating system to attempt
  decrypting it and asking me for the password. In general, an
  intruder who gets my computer without my presence (and this did
  happen) does not need to know there is anything encrypted on
  computer.

- when I decrypt partition, then I have passwords pretty much plain in
  ~/.passwords or in the database (again easily decrypted). Database
  is on encrypted partition too and is started upon decryption of
  $HOME, /tmp and swap partitions must be on randomly encrypted
  partitions. Email is not delivered in /var, it is fetched from
  Internet to $HOME. 

Then I keep the oath-keys in a list:

(defvar oath-keys '(digitalocean "3O1MLC2RYJ5VRDHB" ces "N1YWQ5C3OEXCGWTNLNTUQ2J2FAQXGNTU" namecheap "TW1N5TRK22QOHELVGMBTARV74XYET6HH"))

(defun call-process-to-string (program &optional infile display &rest args)
  (with-temp-buffer
    (apply #'call-process program infile t display args)
    (buffer-string)))

(defun oath ()
  (interactive)
  (let* ((key (rcd-choose (map-keys oath-keys) "OATH Service: "))
	 (result (call-process-to-string "oathtool" nil nil "-b" "--totp=sha1" (plist-get oath-keys (intern "ces"))))
	 (result (string-trim result)))
    (message result)
    (kill-new result)))

And I ask interactively for it with M-x oath 

However, the above function does NOT result with same key when I run
it from Emacs and I would like to find out why. Maybe it uses
different time, I cannot know, it still does not work. Somebody can
help? 

Otherwise in shell, I keep those few authentications as alias,
straight as following:

alias totp-digitalocean='oathtool -b --totp=sha1 3O1MLC2RYJ5VRDHB'

So I just run the alias and get the authentication key.



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30  7:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-30 13:19   ` Felix E. Klee
  2021-09-30 15:36     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 11+ messages in thread
From: Felix E. Klee @ 2021-09-30 13:19 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> I don't know but I think he (Jean) meant Elisp, not Eshell - that's
> what he wrote anyway (Emacs Lisp).

But I meant Eshell.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30  6:35 Backticks in Eshell Felix E. Klee
  2021-09-30  7:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-30  8:45 ` Using oathtool in Emacs - was " Jean Louis
@ 2021-09-30 13:38 ` Joost Kremers
  2021-09-30 13:56   ` Felix E. Klee
  2021-09-30 15:38   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 2 replies; 11+ messages in thread
From: Joost Kremers @ 2021-09-30 13:38 UTC (permalink / raw)
  To: Felix E. Klee; +Cc: help-gnu-emacs


On Thu, Sep 30 2021, Felix E. Klee wrote:
> To generate a one time password, I would do in Bash:
>
>     oathtool -b --totp `gpg -d secret.gpg`
>
> How do I do the equivalent in Eshell?
>
> I tried:
>
>     oathtool -b --totp ${gpg -d secret.gpg}
>
> But that doesn’t work.  Even the following doesn’t work:
>
>     echo ${gpg -h}
>
> I expect GnuPG’s help text, but there’s no output.

Try without the $ sign. This works for me:

    ls -l {which python}

Eshell, unfortunately, isn't very well documented. There's a lot of useful info
in Mastering Emacs[1], tough.

HTH

Joost



[1] https://www.masteringemacs.org/article/complete-guide-mastering-eshell

-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30 13:38 ` Joost Kremers
@ 2021-09-30 13:56   ` Felix E. Klee
  2021-09-30 14:06     ` Joost Kremers
  2021-09-30 15:38   ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 11+ messages in thread
From: Felix E. Klee @ 2021-09-30 13:56 UTC (permalink / raw)
  To: Joost Kremers; +Cc: help-gnu-emacs

On Thu, 30 Sept 2021 at 15:42, Joost Kremers <joostkremers@fastmail.fm>
wrote:
> Try without the $ sign. This works for me:
>
>     ls -l {which python}

Thanks for the suggestion, but `which` is an internal command:
eshell/which

So that doesn’t count. Try:

    echo {gpg -h}

There’s no output.

> Eshell, unfortunately, isn't very well documented. There's a lot of
> useful info in Mastering Emacs[1], tough.

I am aware of that, thanks!



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30 13:56   ` Felix E. Klee
@ 2021-09-30 14:06     ` Joost Kremers
  2021-09-30 15:02       ` Felix E. Klee
  0 siblings, 1 reply; 11+ messages in thread
From: Joost Kremers @ 2021-09-30 14:06 UTC (permalink / raw)
  To: Felix E. Klee; +Cc: help-gnu-emacs


On Thu, Sep 30 2021, Felix E. Klee wrote:
> On Thu, 30 Sept 2021 at 15:42, Joost Kremers <joostkremers@fastmail.fm>
> wrote:
>> Try without the $ sign. This works for me:
>>
>>     ls -l {which python}
>
> Thanks for the suggestion, but `which` is an internal command:
> eshell/which
>
> So that doesn’t count. Try:
>
>     echo {gpg -h}
>
> There’s no output.

Bummer. I didn't realise that might make a difference...

Is using a pipe an option in your use case? This seems to work:

    gpg -h | wc -l

Though you need to hit RET a second time to get a prompt again...

-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30 14:06     ` Joost Kremers
@ 2021-09-30 15:02       ` Felix E. Klee
  2021-09-30 19:17         ` Joost Kremers
  0 siblings, 1 reply; 11+ messages in thread
From: Felix E. Klee @ 2021-09-30 15:02 UTC (permalink / raw)
  To: help-gnu-emacs

Joost Kremers <joostkremers@fastmail.fm> writes:
> Is using a pipe an option in your use case?

Thanks, but no.

Aw, Eshell feels kind of unfinished, although I use it all the time, but
for simple stuff.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30 13:19   ` Felix E. Klee
@ 2021-09-30 15:36     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 11+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-30 15:36 UTC (permalink / raw)
  To: help-gnu-emacs

Felix E. Klee wrote:

>> I don't know but I think he (Jean) meant Elisp, not Eshell
>> - that's what he wrote anyway (Emacs Lisp).
>
> But I meant Eshell.

Okay, great, it just looked like you were talking past each
other ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30 13:38 ` Joost Kremers
  2021-09-30 13:56   ` Felix E. Klee
@ 2021-09-30 15:38   ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 11+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-30 15:38 UTC (permalink / raw)
  To: help-gnu-emacs

Joost Kremers wrote:

> Try without the $ sign. This works for me:
>
>     ls -l {which python}
>
> Eshell, unfortunately, isn't very well documented.

Is Eshell an attempt to use Lisp-like syntax in a shell and
its shell programming language, like the C-ish syntax and
style of csh?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Backticks in Eshell
  2021-09-30 15:02       ` Felix E. Klee
@ 2021-09-30 19:17         ` Joost Kremers
  0 siblings, 0 replies; 11+ messages in thread
From: Joost Kremers @ 2021-09-30 19:17 UTC (permalink / raw)
  To: Felix E. Klee; +Cc: help-gnu-emacs


On Thu, Sep 30 2021, Felix E. Klee wrote:
> Aw, Eshell feels kind of unfinished, although I use it all the time, but
> for simple stuff.

Yes, me too. Always have a shell terminal around for when Eshell behaves
wonky...

-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-09-30 19:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-30  6:35 Backticks in Eshell Felix E. Klee
2021-09-30  7:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30 13:19   ` Felix E. Klee
2021-09-30 15:36     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30  8:45 ` Using oathtool in Emacs - was " Jean Louis
2021-09-30 13:38 ` Joost Kremers
2021-09-30 13:56   ` Felix E. Klee
2021-09-30 14:06     ` Joost Kremers
2021-09-30 15:02       ` Felix E. Klee
2021-09-30 19:17         ` Joost Kremers
2021-09-30 15:38   ` Emanuel Berg via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.