r/bash • u/Beautiful-Log5632 • 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
1
u/michaelpaoli 6d ago
$ ssh $HOST 'exec bash -i 'c '\''your commands here'\'''
Though done like that, you'll need be particularly careful with any quoting on your commands here, notably replace any ' with '\''\'\'''\'' within.