startx 上不存在符号链接脚本

symlink script does not exist on startx

我遇到的问题是 运行 在脚本中创建一个名为 example 的符号 link(示例指向 b.sh)。 来自终端的 运行 $ example 将消息 scriptB was found 附加到日志。如果我从 $HOME 运行 $ ./b.sh 也会发生同样的情况。但是,example 在启动 X 时不会执行。 我在我的系统上创建了以下最小设置来模拟我的问题。

a.sh

#!/bin/bash
type example ||
    echo "error: example could not be found." >>"$HOME/example.log"
~/b.sh

b.sh

#!/bin/bash
echo "scriptB was found" >>"$HOME/example.log"

.xinitrc

#!/bin/sh
if [ -x "$HOME/a.sh" ]; then
    bash ~/a.sh
fi

最小设置

重启X(或重启)后的日志为:

error: example could not be found.
scriptB was found
.... ~/.local/bin/example

因此将该路径添加到 PATH

#!/bin/sh
export PATH="$HOME/.local/bin:$PATH"
example