当 shell 命令完成时如何获得音频通知?

当 shell 命令完成时如何获得音频通知?

这个问题类似,但不同当长时间运行的命令完成时,如何获得音频通知?

我正在寻找一个可以像这样使用的命令

mayberunlongtime; bell

我依稀记得有一个像这样工作和使用的命令存在,但不记得名字了。

有一个用于敲响铃声的 ASCII 字符,但是使用 '\a' printf 来执行此操作看起来有些不明显,甚至不透明。当我尝试时它不起作用。

我用zsh在一个KDE konsole.

答案1

命令行程序英里/加仑123可用于从脚本播放 MP3 文件:

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
    version 1.22.4; written and copyright by Michael Hipp and others
    free software (LGPL) without any warranty but with best wishes

usage: mpg123 [option(s)] [file(s) | URL(s) | -]
supported options [defaults in brackets]:
   -v    increase verbosity level       -q    quiet (don't print title)
   -t    testmode (no output)           -s    write to stdout
   -w f  write output as WAV file
   -k n  skip first n frames [0]        -n n  decode only n frames [all]
   -c    check range violations         -y    DISABLE resync on errors
   -b n  output buffer: n Kbytes [0]    -f n  change scalefactor [32768]
   -r n  set/force samplerate [auto]
   -o m  select output module           -a d  set audio device
   -2    downsample 1:2 (22 kHz)        -4    downsample 1:4 (11 kHz)
   -d n  play every n'th frame only     -h n  play every frame n times
   -0    decode channel 0 (left) only   -1    decode channel 1 (right) only
   -m    mix both channels (mono)       -p p  use HTTP proxy p [$HTTP_PROXY]
   -@ f  read filenames/URLs from f     -T get realtime priority
   -z    shuffle play (with wildcards)  -Z    random play
   -u a  HTTP authentication string     -E f  Equalizer, data from file
   -C    enable control keys            --no-gapless  not skip junk/padding in mp3s
   -?    this help                      --version  print name + version

答案2

您可以使用<command>; xkbbell -force。您可能需要modprobe pcspkr以 root 身份运行。

答案3

<command>; echo '\a'对我有用。

相关内容