1

I must have done something to my environment in Ubuntu 17.10 as alias in the terminal no longer works. Probably/Maybe after a apt-get autoremove (I guess).

Open a terminal and running echo $shell shows nothing but an empty row. I run ps -p $$ and it shows that I'm in bash.

.bash_profile and alias are being recognized if I run source .bash_profile.

What could have happened and what can I do to get alias working again without needing to run source?

wjandrea
  • 14,236
  • 4
  • 48
  • 98
Pal Bergstrom
  • 371
  • 2
  • 8
  • 2
    I suspect the cause is the same as here ~/.profile doesn't run after upgrading to Ubuntu 17.10 - probably the easiest solution is to move the alias definitions to ~/.bashrc, which is sourced for non-login shells (such as those run in the desktop terminal emulator). BTW echo $shell is not the same as echo $SHELL – steeldriver Jan 28 '18 at 00:22
  • @steeldriver Thank you. The strange thing is that it worked before. – Pal Bergstrom Jan 28 '18 at 00:44
  • GNOME Terminal doesn't run login shells by default. You have to set it do so. Probably you did at one time and unset it some other time. – muru Jan 28 '18 at 01:04
  • @muru I think steeldriver pinned down the issue here (Wayland doesn't run a login shell). Voted to reopen. – wjandrea Jan 28 '18 at 03:12
  • @WJAndrea which would be irrelevant for aliases. Aliases don't inherit from the environment, so even if Wayland ran a login shell and read .profile or .bash_profile, it wouldn't create aliases in bash run in GNOME Terminal. – muru Jan 28 '18 at 03:14
  • @muru Oh, you're right, sorry. – wjandrea Jan 28 '18 at 03:29
  • @muru I appreciate the work you do here but the system of marking duplicates is not always fair. Take my question as an example. Unless you're an expert you don't know it's the same problem, though after a while I understood it. But perhaps this is a place for professionals. I says this as I got a warning that I might not be able to ask again. – Pal Bergstrom May 12 '18 at 19:13
  • @PalBergstrom have an upvote, that should hold off the block for now. Note that deleting questions makes it look worse for the autoblock, so don't delete a post if it was marked as a dupe. – muru May 12 '18 at 23:28

0 Answers0