当defshell设置为bash时,如何更改屏幕中的默认目录?

问题描述 投票:0回答:1

我知道在运行screen命令之前,你通常可以在screenrc文件中使用chdir来更改目录。但是,如果我有defshell -bash设置,这对我不起作用。这是一个不起作用的示例文件:

    defshell -bash 
    defscrollback 100000

    hardstatus on
    hardstatus alwayslastline
    hardstatus string "%w%=%m/%d %c"

    chdir /Users/myuser/work
    screen -t "work"

$ screen -c testrc

$ pwd /Users/myuser

注释掉第一行就可以了,但是我想在屏幕上运行bash shell。如果相关,则在OSX上。我的屏幕命令没有别名。

bash unix gnu-screen chdir
1个回答
1
投票

问题是你的defshell指定了一个登录shell,它使它进入主目录。根据screen's manual

shell命令

设置用于创建新shell的命令。这会覆盖环境变量$ SHELL的值。如果你想运行一个期望执行$ SHELL中指定的程序的tty-enhancer,这很有用。如果命令以' - '字符开头,则shell将作为login-shell启动。

如果你改变它

defshell bash

它不应该这样做。

© www.soinside.com 2019 - 2024. All rights reserved.