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执行
a.sh
- link 创建于
$ ln -s ~/a.sh ~/.local/bin/example
- 脚本已通过
$ chmod u+x a.sh b.sh
执行并通过 ls -l
验证可执行
- 在
.bashrc
中将 $HOME/.local/bin
附加到我的 PATH 环境变量
重启X(或重启)后的日志为:
error: example could not be found.
scriptB was found
.... ~/.local/bin/example
因此将该路径添加到 PATH
。
#!/bin/sh
export PATH="$HOME/.local/bin:$PATH"
example
我遇到的问题是 运行 在脚本中创建一个名为 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执行
a.sh
- link 创建于
$ ln -s ~/a.sh ~/.local/bin/example
- 脚本已通过
$ chmod u+x a.sh b.sh
执行并通过ls -l
验证可执行
- 在
.bashrc
中将
$HOME/.local/bin
附加到我的 PATH 环境变量
重启X(或重启)后的日志为:
error: example could not be found.
scriptB was found
.... ~/.local/bin/example
因此将该路径添加到 PATH
。
#!/bin/sh
export PATH="$HOME/.local/bin:$PATH"
example