I was wondering if there was a way to specify commands to run on a new window in screen, such as the motd in a regular terminal session. simply adding a command causes screen to run it and then terminate
I was wondering if there was a way to specify commands to run on a new window in screen, such as the motd in a regular terminal session. simply adding a command causes screen to run it and then terminate
Last edited by HiImTye; June 8th, 2013 at 11:11 AM.
Try the example described in the accepted StackOverflow answer here. Basically you put the startup command you want in ~/.screenrc, as you seem to have tried. However a bash command alone will quickly exit, hence the need for something extra.
If you want to start a screen session with a customized command, then:
screen -c ~/.screenrc-custom
Last edited by hardmath; May 25th, 2013 at 01:47 PM. Reason: syntax to use custom configuration
it didn't work, just terminated as expected
this also didn't work in .screenrc
results inCode:screen -D -R -S tye screen -S tye -X exec ~/Launchers/checkUpdatesCode:invalid option -D invalid option -R invalid option -S cannot exec 'tye'
I switched to tmux, but I solved it by addingtoCode:# -- tmux section -- # check if we're in it if [ -n "$TMUX" ]; then # yes, run our automation alias exit="history -c; exit" checkUpdates else alias exit="history -c; if [ -f $HOME/.bash_history ]; then rm $HOME/.bash_history; fi; if [ -f $HOME/.lesshst ]; then rm $HOME/.lesshst; fi; exit" w0="$(ps -ef | grep tmux | grep -v grep)" # check if tmux is running if [ -n "$w0" ]; then # yes, attach tmux -u attach else # no, start a new session tmux -u fi fiI suspect that it could work similarly for screen.Code:$HOME/.bashrc
Last edited by HiImTye; August 15th, 2013 at 10:17 AM. Reason: updated to newest
Bookmarks