【问题标题】:command not running in etc/rc.local ubuntu命令未在 etc/rc.local ubuntu 中运行
【发布时间】:2014-12-24 13:40:27
【问题描述】:

这是我的整个 rc.local 文件

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
cd ~/xcape && ./xcape -e 'Control_L=Escape'
exit 0

在 Ubuntu 中,我需要在 xcape 目录中运行 ./xcape -e 'Control_L=Escape' 以使我的大写锁定在自己按下时作为 esc 键工作,并在按住时进行控制。

我每次启动计算机时都需要运行这个命令,这很烦人,所以我通读了一些东西以在启动时自动运行这个命令,并且消息来源说要在它所在的出口 0 上方执行命令,并且有绝对路径。当我关闭计算机并打开它时,它不起作用,我的大写锁定键充当控制,但没有像应有的那样逃脱。这就是为什么我得出的结论是我的命令没有被运行。我该怎么办?

【问题讨论】:

  • 我建议这个问题在 Askubuntu、Unix&Linux 或 Superuser 上比在 Stackoverflow 上更受关注。

标签: ubuntu keyboard startup boot rc


【解决方案1】:

有点陈旧,但以防万一,尝试添加命令的完整路径,因为~ 不会被扩展,因此./ 将不起作用。像

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
# 
# By default this script does nothing.
/home/<USER>/xcape -e 'Control_L=Escape'
exit 0

其中 是您的用户名。 还要检查 /etc/rc.local 是否可以执行 chmod +x /etc/rc.local

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-10
    • 1970-01-01
    • 2016-09-24
    • 1970-01-01
    • 1970-01-01
    • 2016-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多