【问题标题】:Could not execute command /usr/bin/bash [closed]无法执行命令 /usr/bin/bash [关闭]
【发布时间】:2021-12-31 19:31:41
【问题描述】:

我正在尝试使用 here 方法在我的 xmobar 上显示音量:

    Config { font = "xft:Ubuntu Mono:pixelsize=16:antialias=true:hinting=true"
            , borderColor = "black"
            , border = TopB
            , bgColor = "black"
            , fgColor = "grey"
            , position = TopP 0 0
            , commands = [ 
                    Run Date "%a %_d.%_m  %H:%M" "date" 10
                    , Run StdinReader
                    , Run Com "/usr/bin/bash" ["-c", "~/.config/xmobar/get-volume.sh"]  "myvolume" 1
            ]
            , sepChar = "%"
            , alignSep = "}{"
            , template = "<fc=#FFF>%StdinReader%</fc>}{<fc=#FFF>%date%</fc> -- %myvolume%"
            }

但我在 xmobar 中收到此消息,而不是显示音量:

无法执行命令 /usr/bin/bash

我尝试用/bin/bashbash 替换/usr/bin/bash,但结果相同

有谁知道问题出在哪里?

当我在终端中运行它时,它工作正常:

$ bash ~/.config/xmobar/get-volume.sh 
Vol: 16%

$type bash 的输出是

bash 被散列(/usr/bin/bash)


grep -3i execv sux 关注strace -s &lt;PID&gt; -fp -o sux 的结果

98743 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98743
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9)                          = 0
98743 <... execve resumed>)             = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC)     = 0
98743 brk(NULL <unfinished ...>
97272 close(11 <unfinished ...>
--
98744 dup2(11, 2)                       = 2
98744 close(11)                         = 0
98744 close(10)                         = 0
98744 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98744
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98744 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98744 brk(NULL <unfinished ...>
--
98745 dup2(11, 2)                       = 2
98745 close(11)                         = 0
98745 close(10)                         = 0
98745 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98745
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98745 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98745 brk(NULL <unfinished ...>
--
98746 dup2(11, 2)                       = 2
98746 close(11)                         = 0
98746 close(10)                         = 0
98746 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98746
97272 close(6)                          = 0
98746 <... execve resumed>)             = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98746 brk(NULL <unfinished ...>
97272 close(9 <unfinished ...>
--
98747 dup2(11, 2)                       = 2
98747 close(11)                         = 0
98747 close(10)                         = 0
98747 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98747
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9 <unfinished ...>
98747 <... execve resumed>)             = 0
97272 <... close resumed>)              = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98747 brk(NULL <unfinished ...>
--
98748 dup2(11, 2)                       = 2
98748 close(11)                         = 0
98748 close(10)                         = 0
98748 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98748
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98748 <... execve resumed>)             = 0
97272 close(9)                          = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98748 brk(NULL <unfinished ...>
--
98749 dup2(11, 2)                       = 2
98749 close(11)                         = 0
98749 close(10)                         = 0
98749 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98749
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98749 <... execve resumed>)             = 0
97272 close(9)                          = 0
98749 brk(NULL <unfinished ...>
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
--
98750 dup2(11, 2)                       = 2
98750 close(11)                         = 0
98750 close(10)                         = 0
98750 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98750
97272 close(6)                          = 0
98750 <... execve resumed>)             = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98750 brk(NULL <unfinished ...>
97272 close(9 <unfinished ...>
--
98751 dup2(11, 2)                       = 2
98751 close(11)                         = 0
98751 close(10)                         = 0
98751 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98751
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98751 <... execve resumed>)             = 0
97272 close(9)                          = 0
98751 brk(NULL <unfinished ...>
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
--
98752 dup2(11, 2)                       = 2
98752 close(11)                         = 0
98752 close(10)                         = 0
98752 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98752
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98752 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9)                          = 0
98752 brk(NULL <unfinished ...>
--
98753 dup2(11, 2)                       = 2
98753 close(11)                         = 0
98753 close(10)                         = 0
98753 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98753
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98753 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98753 brk(NULL <unfinished ...>
--
98754 dup2(11, 2)                       = 2
98754 close(11)                         = 0
98754 close(10)                         = 0
98754 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98754
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98754 <... execve resumed>)             = 0
97272 close(9)                          = 0
98754 brk(NULL <unfinished ...>
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
--
98755 dup2(11, 2)                       = 2
98755 close(11)                         = 0
98755 close(10)                         = 0
98755 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98755
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9 <unfinished ...>
98755 <... execve resumed>)             = 0
97272 <... close resumed>)              = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98755 brk(NULL <unfinished ...>
--
98756 dup2(11, 2)                       = 2
98756 close(11)                         = 0
98756 close(10)                         = 0
98756 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98756
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9 <unfinished ...>
98756 <... execve resumed>)             = 0
97272 <... close resumed>)              = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98756 brk(NULL <unfinished ...>
--
98757 dup2(11, 2)                       = 2
98757 close(11)                         = 0
98757 close(10)                         = 0
98757 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98757
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98757 <... execve resumed>)             = 0
97272 close(9)                          = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98757 brk(NULL <unfinished ...>
--
98758 dup2(11, 2)                       = 2
98758 close(11)                         = 0
98758 close(10)                         = 0
98758 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98758
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9 <unfinished ...>
98758 <... execve resumed>)             = 0
97272 <... close resumed>)              = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98758 brk(NULL <unfinished ...>
--
98759 dup2(11, 2)                       = 2
98759 close(11)                         = 0
98759 close(10)                         = 0
98759 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98759
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98759 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98759 brk(NULL <unfinished ...>
--
98760 dup2(11, 2)                       = 2
98760 close(11)                         = 0
98760 close(10)                         = 0
98760 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98760
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98760 <... execve resumed>)             = 0
97272 close(9)                          = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98760 brk(NULL <unfinished ...>
--
98761 dup2(11, 2)                       = 2
98761 close(11)                         = 0
98761 close(10)                         = 0
98761 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98761
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98761 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98761 brk(NULL <unfinished ...>
--
98762 dup2(11, 2)                       = 2
98762 close(11)                         = 0
98762 close(10)                         = 0
98762 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98762
97272 close(6)                          = 0
98762 <... execve resumed>)             = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98762 brk(NULL <unfinished ...>
97272 close(9 <unfinished ...>
--
98763 dup2(11, 2)                       = 2
98763 close(11)                         = 0
98763 close(10)                         = 0
98763 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98763
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98763 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98763 brk(NULL <unfinished ...>
--
98764 dup2(11, 2)                       = 2
98764 close(11)                         = 0
98764 close(10)                         = 0
98764 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98764
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98764 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98764 brk(NULL <unfinished ...>
--
98765 dup2(11, 2)                       = 2
98765 close(11)                         = 0
98765 close(10)                         = 0
98765 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98765
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98765 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98765 brk(NULL <unfinished ...>
--
98766 dup2(11, 2)                       = 2
98766 close(11)                         = 0
98766 close(10)                         = 0
98766 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98766
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98766 <... execve resumed>)             = 0
97272 close(9)                          = 0
98766 brk(NULL <unfinished ...>
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
--
98767 dup2(11, 2)                       = 2
98767 close(11)                         = 0
98767 close(10)                         = 0
98767 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98767
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98767 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9)                          = 0
98767 brk(NULL <unfinished ...>
--
98768 dup2(11, 2)                       = 2
98768 close(11)                         = 0
98768 close(10)                         = 0
98768 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98768
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98768 <... execve resumed>)             = 0
97272 close(9)                          = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98768 brk(NULL <unfinished ...>
--
98769 dup2(11, 2)                       = 2
98769 close(11)                         = 0
98769 close(10)                         = 0
98769 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98769
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98769 <... execve resumed>)             = 0
97272 close(9)                          = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC)     = 0
98769 brk(NULL <unfinished ...>
--
98770 dup2(11, 2)                       = 2
98770 close(11)                         = 0
98770 close(10)                         = 0
98770 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98770
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98770 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98770 brk(NULL <unfinished ...>
--
98771 dup2(11, 2)                       = 2
98771 close(11)                         = 0
98771 close(10)                         = 0
98771 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98771
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98771 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98771 brk(NULL <unfinished ...>
--
98772 dup2(11, 2)                       = 2
98772 close(11)                         = 0
98772 close(10)                         = 0
98772 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98772
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98772 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98772 brk(NULL <unfinished ...>
--
98773 dup2(11, 2)                       = 2
98773 close(11)                         = 0
98773 close(10)                         = 0
98773 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98773
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9)                          = 0
98773 <... execve resumed>)             = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC)     = 0
97272 close(11 <unfinished ...>
98773 brk(NULL <unfinished ...>
--
98774 dup2(11, 2)                       = 2
98774 close(11)                         = 0
98774 close(10)                         = 0
98774 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98774
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9)                          = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98774 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(11)                         = 0
98774 brk(NULL <unfinished ...>
--
98775 dup2(11, 2)                       = 2
98775 close(11)                         = 0
98775 close(10)                         = 0
98775 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98775
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9 <unfinished ...>
98775 <... execve resumed>)             = 0
97272 <... close resumed>)              = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98775 brk(NULL <unfinished ...>
--
98776 dup2(11, 2)                       = 2
98776 close(11)                         = 0
98776 close(10)                         = 0
98776 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98776
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9 <unfinished ...>
98776 <... execve resumed>)             = 0
97272 <... close resumed>)              = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC)     = 0
98776 brk(NULL <unfinished ...>
--
98777 dup2(11, 2)                       = 2
98777 close(11)                         = 0
98777 close(10)                         = 0
98777 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98777
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
97272 close(9 <unfinished ...>
98777 <... execve resumed>)             = 0
97272 <... close resumed>)              = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98777 brk(NULL <unfinished ...>
--
98778 dup2(11, 2)                       = 2
98778 close(11)                         = 0
98778 close(10)                         = 0
98778 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98778
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98778 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9)                          = 0
98778 brk(NULL <unfinished ...>
--
98779 dup2(11, 2)                       = 2
98779 close(11)                         = 0
98779 close(10)                         = 0
98779 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98779
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC)     = 0
98779 <... execve resumed>)             = 0
97272 close(9)                          = 0
97272 fcntl(8, F_SETFD, FD_CLOEXEC <unfinished ...>
98779 brk(NULL <unfinished ...>
--
98780 dup2(11, 2)                       = 2
98780 close(11)                         = 0
98780 close(10)                         = 0
98780 execve("/bin/bash", ["/bin/bash", "~/.config/xmobar/get-volume.sh"], 0x7fff9c760fc0 /* 45 vars */ <unfinished ...>
97272 <... vfork resumed>)              = 98780
97272 close(6)                          = 0
97272 fcntl(7, F_SETFD, FD_CLOEXEC <unfinished ...>
98780 <... execve resumed>)             = 0
97272 <... fcntl resumed>)              = 0
97272 close(9 <unfinished ...>
98780 brk(NULL <unfinished ...>

【问题讨论】:

  • 看起来是一个非常神秘的问题。可能有各种原因。我不知道 xmobar,但恕我直言,你应该追踪它到底想做什么。运行strace -s 4096 -fp -o sux -p &lt;pid&gt;,其中&lt;pid&gt; 是您的xmobar。它将在名为“sux”的文件中生成 xmobar 进程的内核调用跟踪。然后用它重现问题。然后停止跟踪,并在“sux”文件(`grep -3i execv sux`)中搜索“execv”字符串。如果你能做到这些,那么将这里的输出复制到你的问题中。
  • @peterh 我添加了结果,但不确定我是否做对了 - 你可以在更新的问题中看到我是如何运行命令的
  • 顺便说一句,我强烈建议不要将bash 作为显式解释器传递。如果您将脚本作为带有适当 shebang 的可执行文件(如 #!/usr/bin/env bash#!/usr/bin/bash 等作为第一行),您应该能够使用 Run Com "/home/youruser/.config/xmobar/get-volume",并让操作系统识别解释器以从 shebang 线使用。
  • ...请参阅Commandname Extensions Considered Harmful 回复:为什么上述建议放弃了.sh。 (如果您要获取文件而不是执行它,我建议将扩展名更改为 .bash,以便它实际上与运行脚本的特定 shell 语法变体匹配)。
  • (拥有一个扩展是向读者发出的一个信号,即脚本将由特定的解释器获取或执行;.sh 表示该解释器只保证是 POSIX sh 系列中的东西,.bash 表示它专门用于 bash,而根本没有扩展名向读者表明 shebang 是唯一支持的解释器选择方式,并且该工具可以用不同的语言重写而无需需要修改调用者)。

标签: bash xmonad xmobar


【解决方案1】:

一个波浪号被调用 shell 替换为适当的目录(当波浪号出现在一个不带引号的上下文中作为 shell 正在执行的源代码的一部分时)。这里没有调用shell,只有一个被调用的;波浪号是数据,而不是语法。

所以改变...

"~/.config/xmobar/get-volume.sh"

到:

"/home/youraccount/.config/xmobar/get-volume.sh"

...,到:

"-c", ". ~/.config/xmobar/get-volume.sh"

(这使得-c后面的参数被解析为shell语法,其中~可以被替换)。

【讨论】:

    猜你喜欢
    • 2016-09-12
    • 1970-01-01
    • 2010-12-24
    • 2019-11-06
    • 2019-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多