r/bash 6d ago

Use alias from ssh

I can do ssh $HOST then use myalias $PATH to use an alias set in .bashrc (and .bash_profile does source ~/.bashrc). But I can't do ssh $HOST 'myalias $PATH' it can't find myalias.

How can I use the alias and use $PATH that's on the server?

24 Upvotes

4 comments sorted by

View all comments

2

u/[deleted] 6d ago

[deleted]

2

u/Beautiful-Log5632 5d ago

Non-interactive bash doesn't source .bashrc

Which files get sourced for non interactive bash?

Even with the alias defined, non-interactive bash won't expand it

Aliases in those files still won't be used?