Reputation: 12412
I want to start multiple screens using the mac/linux command screen and have each screen execute my .bashrc and then run a series of aliases/functions from that .bashrc. I have tried adding various commands in my .screenrc as shown below:
screen -t first bash
screen -t SE bash
screen -t myserver bash -i --rcfile <(echo "export PS1='> ' && ls") -i
screen -t myserver bash -i
screen -t myserver /Users/user/bin/mybash
screen -t myserver mybash
screen -t myserver ~/bin/mybash
screen -t myserver bash --init-file <(echo "source .bashrc; runapp")
screen -t myserver2 bash --init-file <(echo ". .bashrc; runapp")
but the aliases don't get executed. What am I doing wrong?
Upvotes: 0
Views: 486
Reputation: 118
Ok, here is how you can use aliases with screen.
~$ cat .profile
shopt -s expand_aliases
alias ping1="ping 8.8.8.8"
alias ping2="ping 8.8.4.4"
~$ cat .screenrc
screen -t app1 bash -lc ping1
screen -t app2 bash -lc ping2
~$ screen
Even though, it's possible to achieve it doesn't feel like a great idea. People are avoiding "expand_aliases" for reason.
Upvotes: 1