I am on Ubuntu 22.04 platform.
I made a simple push button GUI in c named t2s
and placed it in ~/.local/bin
whose path is added to PATH
environment variable. While I am pressing down the button, it is recording voice from mic to a temp file. When I release the button GUI exits.
I run the following line which works well within terminal:
t2s && notify-send -u normal -t 10000 "$( whispercpp -m /home/****/Desktop/2022-10/whisper.cpp/models/ggml-small.bin -nt -l tr -f /dev/shm/mic.wav )"
Voice is sent to whispercpp
speech to text engine and transcribed. The result is shown in the notification on the screen.
But when I place that line in a file and launch it, such as:
#!/bin/bash
t2s && notify-send -u normal -t 10000 "$( whispercpp -m /home/****/Desktop/2022-10/whisper.cpp/models/ggml-small.bin -nt -l tr -f /dev/shm/mic.wav )"
exit 0
it only executes the GUI button, when the GUI exits after releasing button, it doesn't execute
notify-send -u normal -t 10000 "$( whispercpp -m /home/****/Desktop/2022-10/whisper.cpp/models/ggml-small.bin -nt -l tr -f /dev/shm/mic.wav )"
part
What am I doing wrong?
EDIT:
I also tried it like this:
#!/bin/bash
t2s
TEXT=$( whispercpp -m /home/****/Desktop/2022-10/whisper.cpp/models/ggml-small.bin -nt -l tr -f /dev/shm/mic.wav )"
notify-send -u normal -t 10000 $TEXT
Nothing's changed.
EDIT:
I noticed that it's related to shell internals.
I still don't know how to overcome it.