A basic question about making alias

I'm new at FreeBSD and I'm tinkering with stuff. I have a question about aliases. I read in earlier posts regarding Midnight Commander and the sh shell.
So I installed bash, and I found that typing:
Code:
env SHELL=/usr/local/bin/bash mc
works just fine and MC starts in sh without complaint. I am trying to make an alias so I don't have to type out the env thing, but I can't get the alias work. I put the alias in root's .shrc file. I also tried putting it in /etc/rc.conf. I tried it two ways:
Code:
alias mc='env SHELL=/usr/local/bin/bash mc'
and then with a made-up name:
Code:
alias midcom='env SHELL=/usr/local/bin/bash mc
Yes I did read the man page about 'alias'. I notice it talks about built-in commands. So I'm probably doing it all wrong.

As I said, I'm tinkering and learning. How is one supposed to use the above environment command?
 
The alias itself looks good. The second one is missing a closing single quote.

Did you logged out and logged in so the shell can re-read it's .shrc for the alias to take effect?

Alternatively source sh(1) configuration file without logging out/in.

. .shrc


rc.conf(5) is not meant to set aliases. For it's purpose, see manual.
Yes, I did logout/in (as well as restarting).

I am wondering if lines 4 and 5 of the .shrc are involved in this:
Code:
This file will be used if the shell is invoked for interactive use and the environment variable ENV is set to this file.
Then it says see sh(1) and environ(7), but that didn't help me.
 
I am wondering if lines 4 and 5 of the .shrc are involved in this:
Code:
This file will be used if the shell is invoked for interactive use and the environment variable ENV is set to this file.
Then it says see sh(1) and environ(7), but that didn't help me.
That's a reference to ~/.profile:
Code:
# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV

When executing alias alone in the shell, is the mc alias listed?
 
That's a reference to ~/.profile:
Thank you. Yes, the .shrc is invoked in the .profile file.

When executing alias alone in the shell, is the mc alias listed?
Yes it is now. I had deleted the line last night, and today, after I re-entered the alias, it is working. It could have been the missing " ' " although I hadn't copied and pasted the line of text because I'm in a VM and clipboard sharing doesn't work - haven't got to that point yet.

Thanks for your assistance.
 
Back
Top