Page 1 of 1
Alias problem
Posted: Sun Jun 22, 2014 1:46 am
by sehoonha
Hi,
I using Linux Mint 17 that is upgraded from Linux Mint 16.
I tried to set aliases as usual, but it goes very wrong
This is ".bash_profile" in my home directory
=======
alias install='sudo apt-get install'
=======
It is just a single line, very simple.
But if I typed "alias" to check aliases, it goes totally wrong.
=======
sehoonha@constantinople ~ $ alias
alias grep='grep --colour=auto'
'lias install='sudo apt-get install
alias ll='ls -al'
alias ls='ls --color=auto'
=======
See? How can possibly an entry starts with 'lias?
Of course, if I type install....
=======
sehoonha@constantinople ~ $ install
[sudo] password for sehoonha:
E: Invalid operation install
=======
If someone could help me to resolve this problem, I will really appreciate...
Re: Alias problem
Posted: Sun Jun 22, 2014 8:58 am
by Habitual
Code: Select all
alias install='sudo apt-get install'
then exit the editor and type in shell:
then type install <package>
enter sudo password and ta da!
you can always check your aliases with
or
Re: Alias problem
Posted: Sun Jun 22, 2014 2:05 pm
by sehoonha
Thanks for your kind response.
But the problem is that aliases are messed up only when it is *automatically* loaded from .bashrc.
Re: Alias problem
Posted: Sun Jun 22, 2014 4:57 pm
by Habitual
sehoonha wrote:Thanks for your kind response.
But the problem is that aliases are messed up only when it is *automatically* loaded from .bashrc.
Show us your .bashrc then.
I usually create aliases directly in .bashrc or use
Code: Select all
source /path/to/another/alias/file
in .bashrc
Remove any alias causing issue from .bash_profile
and move it somewhere else, either in .bashrc or a new file and source it in .bashrc
I use .aliases (one of many such files) like so:
Code: Select all
grep aliases .bashrc | grep source
source /home/jj/.aliases
and in it are such things as:
Code: Select all
alias stampl="date '+%a %b %d, %Y - %l:%M:%S %p %Z'" # original date/time stamp
alias stamp="date '+%a %b %d, %Y'"
alias ipcalc='ipcalc -b'
alias cal='cal -3'
alias ip="curl icanhazip.com"
alias heat="sensors -f"
Your alias is probably being 'stepped on' by another alias of similar definition.
in your ~ (home) directory type this:
Code: Select all
grep -w apt-get" .* | grep -v .bash_history
or
What shows up?
You can test aliases with putting them anywhere by using a "--norc option in bash with
then type
Code: Select all
alias install="sudo apt-get install"
right in the shell.
Verify by typing
you should see
Code: Select all
alias install='sudo apt-get install'
test it directly with
install <some_program>
Let us know...
Once it behaves as expected in the "bash --norc" environment, then move it to either .basrhrc
or another sourced file from .bashrc
NOTE: I declared this same alias like
Code: Select all
alias install="sudo apt-get install"
but when I check it, it shows up as
Code: Select all
alias install='sudo apt-get install'
Re: Alias problem
Posted: Mon Jun 23, 2014 8:44 pm
by sehoonha
In fact, as I stated, a single line of "alias install='sudo apt-get install'" is all of my .bashrc.
And the following is the result that I checked by typing "alias"
====
'lias install='sudo apt-get install
====
Of course, if I directly type " alias install='sudo apt-get install' ", it worked very well as usual.
Re: Alias problem
Posted: Tue Jun 24, 2014 3:44 pm
by Habitual
show us your ~/.bash_profile please.
Re: Alias problem
Posted: Tue Jun 24, 2014 10:38 pm
by sehoonha
I have ~/.profile, which is following
Code: Select all
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Re: Alias problem
Posted: Tue Jun 24, 2014 11:01 pm
by WharfRat
Does this return anything
Re: Alias problem
Posted: Tue Jun 24, 2014 11:03 pm
by sehoonha
Code: Select all
sehoonha@constantinople ~ $ grep -w lias ./.*
grep: ./.: Is a directory
grep: ./..: Is a directory
./.bash_history:grep -w lias ./.*
./.bash_history:grep -w lias ./.*
grep: ./.cache: Is a directory
grep: ./.cinnamon: Is a directory
grep: ./.config: Is a directory
grep: ./.dbus: Is a directory
grep: ./.dotfiles: Is a directory
grep: ./.dropbox: Is a directory
grep: ./.dropbox-dist: Is a directory
grep: ./.dropbox-master: Is a directory
grep: ./.emacs.d: Is a directory
grep: ./.gconf: Is a directory
grep: ./.gimp-2.8: Is a directory
grep: ./.gnome: Is a directory
grep: ./.gnome2: Is a directory
grep: ./.gnome2_private: Is a directory
grep: ./.linuxmint: Is a directory
grep: ./.local: Is a directory
grep: ./.mozilla: Is a directory
grep: ./.pki: Is a directory
grep: ./.semanticdb: Is a directory
grep: ./.smartgit: Is a directory
grep: ./.speech-dispatcher: Is a directory
grep: ./.subversion: Is a directory
grep: ./.thumbnails: Is a directory
grep: ./.Trash: Is a directory
sehoonha@constantinople ~ $
Re: Alias problem
Posted: Tue Jun 24, 2014 11:12 pm
by WharfRat
Re: Alias problem
Posted: Tue Jun 24, 2014 11:13 pm
by sehoonha
Code: Select all
sehoonha@constantinople ~ $ grep -w alias ./.*
grep: ./.: Is a directory
grep: ./..: Is a directory
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias make=
./.bash_history:alias
./.bash_history:alias make=make -j4
./.bash_history:alias
./.bash_history:alias make='make -j4'
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias --help
./.bash_history:alias p
./.bash_history:alias -p
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:locate alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bash_history:alias
./.bashrc:alias install='sudo apt-get install'
grep: ./.cache: Is a directory
grep: ./.cinnamon: Is a directory
grep: ./.config: Is a directory
grep: ./.dbus: Is a directory
grep: ./.dotfiles: Is a directory
grep: ./.dropbox: Is a directory
grep: ./.dropbox-dist: Is a directory
grep: ./.dropbox-master: Is a directory
grep: ./.emacs.d: Is a directory
grep: ./.gconf: Is a directory
grep: ./.gimp-2.8: Is a directory
grep: ./.gnome: Is a directory
grep: ./.gnome2: Is a directory
grep: ./.gnome2_private: Is a directory
grep: ./.linuxmint: Is a directory
grep: ./.local: Is a directory
grep: ./.mozilla: Is a directory
grep: ./.pki: Is a directory
grep: ./.semanticdb: Is a directory
grep: ./.smartgit: Is a directory
grep: ./.speech-dispatcher: Is a directory
grep: ./.subversion: Is a directory
grep: ./.thumbnails: Is a directory
grep: ./.Trash: Is a directory
sehoonha@constantinople ~ $
Re: Alias problem
Posted: Tue Jun 24, 2014 11:17 pm
by WharfRat
Call the alias something else, it might be due to the /usr/bin/install file
Re: Alias problem
Posted: Wed Jun 25, 2014 2:36 pm
by WharfRat
WharfRat wrote:Call the alias something else, it might be due to the /usr/bin/install file
@ sehoonha,
I tried the same alias as you and it worked. Are you sourcing anything in /etc/profile, /etc/profile.d/, /etc/bash.bashrc, ~/.bash_profile, ~/.bash_login, ~/.bashrc or ~/.profile
This is certainly odd
Re: Alias problem
Posted: Wed Jun 25, 2014 3:39 pm
by Habitual