Aliases set in ~/.bash_profile not recognized on macOS
valdotdev opened this issue ยท 12 comments
Says "command not found".
Normal commands works fine
I've got this problem as well, using zsh
Same problem on Ubuntu 16.04, it does not recognize alias set in ~/.bash_aliases.
I'll try to check it, but I think we just have to include .bash_profile
on initialization, before executing script, that user enters
Any updates on this? I am lacking the coding skills, but this would be a huge improvement for me.
same problem one year after
I'm experiencing aliases not being recognized when using MacOS as well. Many discussions about the following files relating to bash*
is all over the place (see below). The issue here is there's no explanation of what each file represents and how it's co-related to other files within the home directory. What's more confusing is how there's bash* related files within /etc/ directory also. How do I set terminal-aliases in mac and not in a way that's automatically run every time you launch terminal window?
Home Directory bash-related files
~/.bash_aliases (meant to have aliases, but isn't recognized)
~/.bash_profile (meant to autorun commands when terminal opens which is working for me but can't run those aliases after initial launch)
~/.bashrc (???)
~/.profile (???)
An alias example would be to do a task that takes longer if typed out manually as opposed to a keyword that can run that very same long command (like so):
alias editthisfile=cd /etc/bashrc && vim ./bashrc
if not working use next one, but it's up to you to edit the METHOD of doing things. use this instead if previous isn't working alias editthisfile=nano /etc/bashrc
no solution?
I'll try to check it, but I think we just have to include
.bash_profile
on initialization, before executing script, that user enters
please explain how to do this
I could not make it read aliases, but creating a shell script in /usr/local/bin (or any other bin location), solved my problem with running custom commands on Cerebro.
Here is my file named upper
#! /bin/bash
a=$1
b=`echo "print '$a'.upper()" | python`
echo "$b"
So running upper lower_case_string, outputs LOWER_CASE_STRING
why are you trying zsh to read bash files? just put the aliases on .zshrc
Recently hd the same problem, @sebolio comment helped me.
I created a .zshrc file and ran my .bashrc file(containing alias) from this file as following
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Still the same problem.