Bash aliases don't work in Midnight Commander

Hello!
I have some aliases in bash. When I run Midnight Commander from bash, command alias has empty output. And, accordingly, aliases can't be executed under MC, I get
Code:
error: /usr/local/bin/bash: ll: command not found

MC 4.1.40
Bash 4.3.0
Thanks in advance.
 
Maybe I explained unclearly. Scenario:
  1. Launch MC
  2. Type alias (or ll, for example) in command line of MC
  3. Code:
    /usr/local/bin/bash: ll: command not found
 
Where do you set these aliases? Probably, the bash instance run from inside mc just doesn't read them, because it's not run as a login shell. See the Bash Reference Manual for details, when which startup file is loaded by bash.
 
Aliases are defined in ~/.bashrc. I enter to server. In bash command line aliases are working. After that I launch MC. And those aliases are not working in MC command line.
 
They're working just fine here, with some work. If your login shell is bash, then the alias should be set in .bash_profile. If your login shell is something else, and you invoke bash manually, the aliases work when set from .bashrc. In my instance, if I start bash, then start mc, then the mc shell is still tcsh, which didn't have the aliases set in .cshrc and such, so the aliases didn't work. If I started mc like env SHELL=/usr/local/bin/bash mc, mc did start with bash for the prompt.
 
My login shell is bash. Aliases were defined in .bash_profile, after I created .bashrc as ln .bash_profile .bashrc.
I start mc from bash and SHELL in mc has correct value:

Code:
~>mc
$ env
...
SHELL=/usr/local/bin/bash

But after I get:

Code:
~>mc
$ ll
/usr/local/bin/bash: ll: command not found


Where does mc search aliases?
 
Try this in ~/.bash_profile, and if it doesn't work, try again in ~/.bashrc:

Code:
alias ll='ls -l'
Otherwise, read those man pages for bash(1) (near the bottom of the page) and mc(1) ("The subshell support", a fairly detailed read). There are varying behaviors, depending on whether the alias is typed in just after starting mc, or whether the F10 key has been hit beforehand. I don't have a full grasp of the behavior yet.
 
Back
Top