[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash source code block: problem after ssh commands
From: |
Alain . Cochard |
Subject: |
Re: bash source code block: problem after ssh commands |
Date: |
Fri, 27 Oct 2023 20:26:54 +0200 |
Ihor Radchenko writes on Thu 26 Oct 2023 13:44:
> I can now reproduce the problem locally.
>
> It boils down to
>
> (setq exit-status
> (process-file shell-file-name input-file
> (if error-file
> (list t error-file)
> t)
> nil shell-command-switch command))
>
> that is an equivalent of
>
> bash -c bash /path/to/file-containing-the-source-code.sh
>
> ----- file-containing-the-source-code.sh ----
> ssh localhost 'echo foo>/tmp/foo_file'
> echo $(uname -a) |tee /tmp/uname1.txt
> ---------------------------------------------
> If one tries to evaluate the above, the second line is not produced. It
> has nothing to do with Emacs itself.
I am confused about what you specifically do to "evaluate the above".
To start with, I have to use quotes to make your command be performed:
bash -c "bash /path/to/file-containing-the-source-code.sh"
Without the quotes, the 1st line is not executed either. NB: I get
the same behavior with simply
bash /path/to/file-containing-the-source-code.sh
or, after making the script executable with 'chmod +x':
/path/to/file-containing-the-source-code.sh
But most importantly, the second line *is* produced, either if I use
an SSH key for passwordless access or if I enter the password
manually.
> However, if I try
>
> (process-file "bash" "/tmp/test.sh"), the /tmp/uname1.txt is not
> produced.
Here too, it is not clear to me how you "try". The way I know is to
highlight
(process-file "bash" "/path/to/file-containing-the-source-code.sh")
and do
M-x eval-region
In this case, indeed, the 1st line is executed but not the 2nd one
(again, whether or not I use an SSH key).
--
EOST (École et Observatoire des Sciences de la Terre)
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 110] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | [ slot available for rent ]
Re: bash source code block: problem after ssh commands, Russell Adams, 2023/10/26