unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs freezing when running any shell command after loading bashrc file with a specific line
       [not found] <4a3e5a99-41db-af2a-8165-9454df54ac45@algerian-radio.dz>
@ 2024-09-11 15:22 ` Yassine Chaouche
  2024-09-12  9:32   ` Yassine Chaouche
  0 siblings, 1 reply; 2+ messages in thread
From: Yassine Chaouche @ 2024-09-11 15:22 UTC (permalink / raw)
  To: help-gnu-emacs

Dear list,

I'm turning to you in the hope to get help from users who might have experienced the same problem as I am.
It has to do with calling shell commands from emacs after loading bashrc.
To reproduce the problem:

1. Create a .bashrc_emacs file with a simple 3-lines content like this one:

# -*- shell-script -*-
export PATH="$PATH":~/SYNCHRO/bin/ # put the path to where net.ip.private is
export BOOTTIME=$(sys.boottime)


2. Create and chmod +x the sys.boottime shell script with a simple content like this one:

#!/bin/bash
last reboot | awk 'NR == 1 {print $5,$6,$7,$8}'

3. Evaluate this line of elisp code to load the bashrc_emacs file prior to executing a shell command with M-!:

(setenv "BASH_ENV" (expand-file-name "~/.bashrc_emacs"))


4. Then call any shell command, like a simple echo "hello world!"

In my case, it simply freezes.
if I replace this line in the bashrc_emacs file:

export BOOTTIME=$(sys.boottime)

with this line:

export UP=$(last reboot | awk 'NR == 1 {print $5,$6,$7,$8}')

then everything works right.
it only freezes when I use that script,
which is in the path by the way.
you can even comment that line:


# export UP=$(last reboot | awk 'NR == 1 {print $5,$6,$7,$8}')
# or
# export BOOTTIME=$(sys.boottime)

and M-! echo $BOOTTIME
which should return last time your machine booted.

Any help appreciated.
This is Emacs 24 running on linux.


Best,


-- 
yassine -- sysadm
+213-779 06 06 23
http://about.me/ychaouche
Looking for side gigs.



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

* Re: Emacs freezing when running any shell command after loading bashrc file with a specific line
  2024-09-11 15:22 ` Emacs freezing when running any shell command after loading bashrc file with a specific line Yassine Chaouche
@ 2024-09-12  9:32   ` Yassine Chaouche
  0 siblings, 0 replies; 2+ messages in thread
From: Yassine Chaouche @ 2024-09-12  9:32 UTC (permalink / raw)
  To: help-gnu-emacs

Le 9/11/24 à 16:22, Yassine Chaouche a écrit :
>[...]
> 
> 1. Create a .bashrc_emacs file with a simple 3-lines content like this one:
> 
> # -*- shell-script -*-
> export PATH="$PATH":~/SYNCHRO/bin/ # put the path to where net.ip.private is
> export BOOTTIME=$(sys.boottime)
Sorry I meant to say where sys.boottime is.
My initial mail went with net.ip.private,
but it is a script that uses ifdata which is not installed by default,
so I have written another script that uses last and awk,
which should be installed by default on all modern linuces.


Best,
-- 
yassine -- sysadm
+213-779 06 06 23
http://about.me/ychaouche
Looking for side gigs.



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

end of thread, other threads:[~2024-09-12  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4a3e5a99-41db-af2a-8165-9454df54ac45@algerian-radio.dz>
2024-09-11 15:22 ` Emacs freezing when running any shell command after loading bashrc file with a specific line Yassine Chaouche
2024-09-12  9:32   ` Yassine Chaouche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).