0

我正在尝试使用此处的方法在我的 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

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

有谁知道问题是什么?

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

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

的输出$type bash

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


grep -3i execv sux跟随的结果strace -s <PID> -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 ...>
4

1 回答 1

3

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

所以换...

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

至:

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

..., 至:

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

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

于 2021-12-31T23:01:45.423 回答