1

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?

NickD
  • 27,023
  • 3
  • 23
  • 42
jjk
  • 705
  • 4
  • 16
  • 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 Apr 03 '22 at 14:32
  • the question you link to asks about `M-x shell`, not `M-x eshell` – Tyler Apr 03 '22 at 14:34
  • I answered a similar question a while ago. Check this out: https://emacs.stackexchange.com/a/74388/37580 – g-gundam Apr 29 '23 at 00:36

1 Answers1

0

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)
Nsukami _
  • 6,341
  • 2
  • 22
  • 35