2

NOT Working: /bin/bash: Psu: command not found

M-! cmd Psu

Working

M-! cmd ls

.bashrc

cat ~/.bashrc | grep Psu
cat ~/.bashrc | grep aliases

 alias Psu='sudo pacman -Syyu'
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

.bash_profile

cat ~/.bash_profile | grep -A 2 bashrc

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

.bash_aliases

cat ~/.bash_aliases

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

I've read and followed: https://emacs.stackexchange.com/a/28999/21118

What am I missing?

3
  • 1
    From your comments to the answer below it appears you are using eshell. Eshell is a terminal emulator written entirely in elisp. It doesn't run bash or zsh, it is a separate stand-alone program. As such it uses its own configuration, and won't read any if the bash files. If you want to run bash in Emacs, look at M-x shell or M-x term
    – Tyler
    Commented Apr 3, 2022 at 14:32
  • the question you link to asks about M-x shell, not M-x eshell
    – Tyler
    Commented Apr 3, 2022 at 14:34
  • I answered a similar question a while ago. Check this out: emacs.stackexchange.com/a/74388/37580
    – g-gundam
    Commented Apr 29, 2023 at 0:36

1 Answer 1

1

From the documentation:

To specify the shell file name used by M-x shell, customize the variable explicit-shell-file-name. If this is nil (the default), Emacs uses the environment variable ESHELL if it exists. Otherwise, it usually uses the variable shell-file-name

You obviously want to use bash shell; may I suggest a piece of my Emacs configuration:

;; make emacs recognize my bash aliases and functions & use bash as default shell                                                                                              
(setq explicit-shell-file-name "/bin/bash")                                                                                                                                    
(setq shell-file-name "bash")                                                                                                                                                  
(setq explicit-bash.exe-args '("--noediting" "--login" "-ic"))                                                                                                                 
(setq shell-command-switch "-ic")                                                                                                                                              
(setenv "SHELL" shell-file-name)
4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.