我的.screenrc文件中有以下内容:
# Don't display the copyright page startup_message off # keep scrollback n line defscrollback 5000 # setup some screens screen -t top 0 top -o cpu -s 5 screen -t mysql 1 mysql -u root -p screen -t shell_screen 2 cd ~/webroot screen -t report_gen 3 tail -f ~/webroot/path/report_gen_log.txt shelltitle "$ |bash" #change the hardstatus settings to give an window list at the bottom of the ##screen, with the time and date and with the current window highlighted hardstatus alwayslastline #hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}' hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
当我启动屏幕时,只有前两个屏幕被创build。
什么可能是错的?
我runnong OSX,但我不认为这个问题。
凯尔是正确的 – 屏幕窗口2将失败,因为CD是壳内置。 即使它是一个命令,它会立即终止,屏幕将closures该窗口。
你可以做这样的事情来得到这个工作:
screen -t shell_screen 2 bash -c "cd ~/webroot && bash"
尾部命令(窗口3)由于“〜”字符而失败。 屏幕没有进行shell风格的扩展,所以tail立即失败(无法打开文件)并终止,屏幕窗口closures。 手动扩展〜到您的主目录的完整path,该屏幕应该工作。
不知道为什么尾巴失败,但是CD是一个内置的shell,而不是一个命令,所以你应该在窗口2中没有这样的命令。