[[+content_image]]
K
K
ksvdon2014-06-25 23:21:08
bash
ksvdon, 2014-06-25 23:21:08

One entry in alias is missing. Why?

I write in the console "alias" and get

[[email protected] ~]$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mc='. /usr/libexec/mc/mc-wrapper.sh'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

I'm interested in the alias ls='ls --color=auto'string it is necessary to remove (if any) alias for ls in the script. What would work as intended. I write something like this in a script
#!/bin/bash
. $HOME/.bashrc
alias

and get the answer
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .*'
alias ll= 'ls -l'
alias mc='. /usr/libexec/mc/mc-wrapper.sh'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
i.e. everything except the one that interests me alias ls='ls --color=auto'(well, or whatever it would be on some other machine). The fact is that there is no "ls=" entry. There is no point in writing further. missing line...

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
J
jcmvbkbc, 2014-06-26
@jcmvbkbc

When asked why, the answer is:
~/.bashrc pulls /etc/bashrc, which only pulls /etc/profile.d if the shell is interactive. The alias for ls comes from there. For a non-interactive shell, you can add . /etc/profile to load this alias anyway.
If the goal was to remove the alias, but it doesn’t exist anyway, then that’s it, the task is solved.

V
Vlad Zhivotnev, 2014-06-26
@inkvizitor68sl

> because it is necessary to remove (if any) alias for ls in the script. What would work as intended. I write in a script such piece
Launch \ls or /bin/ls in an explicit form.
No need to shit-code on the bash =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question