English 中文(简体)
Custom script in .screenrc
原标题:

I made a script that spawns a remote shell or runs a local shell whether it s on the current machine or not:

#!/bin/bash
# By:  benoror <benoror@gmail.com>
#
# spawns a remote shell or runs a local shell whether it s on the current machine or not
# $1 = hostname

if [ "$(hostname)" == "$1" ]; then
    bash
else
    ssh "$1.local"
fi

For example, if I m on server1:

./spawnshell.sh server1   -> runs bash
./spawnshell.sh server2   -> ssh to server2.local

I want that script to run automatically in separate tabs in GNU Screen, but I can t make it run, my .screenrc:

...
screen -t "@server1"  1   exec /home/benoror/scripts/spawnshell.sh server1
screen -t "@server2"  2   exec /home/benoror/scripts/spawnshell.sh server2
...

But it doesn t works, I ve tried without exec , with -X option and a lot more. Any ideas ?

最佳回答

I use the following:

screen -t gmail alpine -i -p $HOME/.pinerc-gmail
screen -t work  alpine -i -p $HOME/.pinerc-work

And that works great. What are the 1 and 2 for? Have you tried removing them?

Could you try it using another program than spawnshell? Maybe start up vim and emacs? If those work, then your script is at fault and not your screenrc.

问题回答

暂无回答




相关问题
switching between screens

I m using GNU screen just recently. I m wondering if there is an easier way to switch between screen. for example to map it to alt+left arrow and alt+right arrow ?

Custom script in .screenrc

I made a script that spawns a remote shell or runs a local shell whether it s on the current machine or not: #!/bin/bash # By: benoror <benoror@gmail.com> # # spawns a remote shell or runs a ...

GNU Screen: Changing Global Key-binding

I ve recently started using screen in remote sessions. One problem is that emacs doesn t recognize its C-a and I don t want to bind emacs C-a to something else, as I m very used to it. Google shows ...

Set screen-title from shellscript

Is it possible to set the Screen Title using a shell script? I thought about something like sending the key commands ctrl+A shift-A Name enter I searched for about an hour on how to emulate ...

热门标签