命令没有在etc / rc.local ubuntu中运行

时间:2014-10-28 23:39:23

标签: ubuntu keyboard startup boot rc

这是我的整个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 -e' Control_L = Escape'在xcape目录中,为了使我的大写锁定在按下时作为esc键工作,并在按下时进行控制。

我每次启动计算机时都需要运行此命令,这很烦人,所以我通读事情在启动时自动运行此命令,并且源代表执行命令在出口0上方执行,并且有绝对路径。当我关闭计算机并将其打开时,它不起作用,我的大写锁定键作为控制,但不能像它应该那样逃避。这就是为什么我得出的结论是我的命令没有被运行。我该怎么办?

1 个答案:

答案 0 :(得分: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

其中&lt; USER&gt;是你的用户名。 还要检查/etc/rc.local是否可执行chmod +x /etc/rc.local