You are not logged in.

#1 2021-10-08 22:20:41

MegaMexican
Member
Registered: 2021-10-08
Posts: 29

[SOLVED] .bashrc Aliases Don't Work

I have two lines in ~/.bashrc that read

alias sudo='sudo -v; sudo '
alias update='sudo pacman -Syu'

I also have those lines in /etc/bash.bashrc.

Yet for some reason, typing "update" in the terminal yields

$ update
update may be found in the following packages:
  community/gitlab 13.9.4-1     /usr/share/webapps/gitlab/bin/update
  community/gitlab 13.9.4-1     /usr/share/webapps/gitlab/vendor/bundle/ruby/2.7.0/gems/bootstrap_form-4.2.0/demo/bin/update
  community/mailman 2.1.34-2    /usr/lib/mailman/bin/update

I can set the alias for the specific terminal session as such:

$ alias update='sudo pacman -Syu'
$ update 
:: Synchronizing package databases...

etc.

Of course, if I do this then it won't save the alias for any other terminal session. I have tried rebooting and the .bashrc aliases are still not working, and I made sure they're not commented. I can't find anything from the Bash or Sudo pages on the Archwiki that give any further instruction on this, so I really don't understand what's going on here. I'm undoubtedly missing something, I'm just too much of a noob to figure it out on my own.

Last edited by MegaMexican (2021-10-09 04:37:25)

Offline

#2 2021-10-08 23:34:50

flyingscorpio
Member
Registered: 2020-06-04
Posts: 34

Re: [SOLVED] .bashrc Aliases Don't Work

What does

$alias update

in a terminal return?

Offline

#3 2021-10-08 23:45:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,497
Website

Re: [SOLVED] .bashrc Aliases Don't Work

And

echo $0

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2021-10-08 23:47:22

MegaMexican
Member
Registered: 2021-10-08
Posts: 29

Re: [SOLVED] .bashrc Aliases Don't Work

$ alias update
alias: Body cannot be empty
$ echo $0
 

$ echo $0 produces a blank line.

Last edited by MegaMexican (2021-10-08 23:48:05)

Offline

#5 2021-10-09 00:36:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,497
Website

Re: [SOLVED] .bashrc Aliases Don't Work

Ah, ok, usually it'd give the name of the shell.  Are you sure you are running bash (not zsh, or some other shell)?  The following may also confirm:

cat /proc/$$/cmdline
echo $SHELL

Can you define other things in your bashrc that are picked up in your interactive shell?

EDIT: these do not look like bash error messages.

EDIT 2: these are 'fish' error messages.  If you are running the fish shell, obviously bashrc will not be read!  Follow the wiki for your shell.

Last edited by Trilby (2021-10-09 01:13:52)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2021-10-09 04:34:05

MegaMexican
Member
Registered: 2021-10-08
Posts: 29

Re: [SOLVED] .bashrc Aliases Don't Work

Yep, you are spot on! I completely forgot that I technically am not using bash. It's easy to forget since fish uses all the same commands for the most part. Here's how to do it for fish:

$ alias update='sudo pacman -Syu'
$ funcsave update

And now it works across any terminal session.

I knew I was missing something! Thanks for helping me figure it out, now my noobery has gone down a little bit I hope. And thanks for being patient with my suboptimal responses, I'll try to be more detailed in the future.

Last edited by MegaMexican (2021-10-09 04:34:30)

Offline

Board footer

Powered by FluxBB