I'm trying to understand the codes in this project: https://github.com/benoitfragit/google2ubuntu/blob/master/record.sh
#!/bin/sh
# configuration file
CONFIGURATION="$HOME/.config/google2ubuntu/google2ubuntu.conf"
# default recording time
recording=5
if [ -f "$CONFIGURATION" ];
then
{
# load the configuration
. "$CONFIGURATION"
# small security test
if [ "$recording" = "" ];
then
recording=5
fi
}
fi
# get the pid
PID=$1
# kill the previous instance of rec to cascade commands
killall rec 2>/dev/null
# record during fixed seconds
( rec -r 16000 -d /tmp/voix_$PID.flac ) & pid=$!
( sleep "$recording"s && kill -HUP $pid ) 2>/dev/null & watcher=$!
wait $pid 2>/dev/null && pkill -HUP -P $watcher
exit 0;
I didn't understand this: . "$CONFIGURATION" # load the configuration
What kind of loading, running a .conf file? But it isn't a program?
and also I didn't understand the last five lines.
( rec -r 16000 -d /tmp/voix_$PID.flac ) & pid=$!
OK record an audio file, save it to tmp/ directory & What? :)
( sleep "$recording"s && kill -HUP $pid ) 2>/dev/null & watcher=$!
wait $pid 2>/dev/null && pkill -HUP -P $watcher
I did not understand anything from these two lines.
exit 0;
I think it means "return 0" and it is like "return True" in programming languages. Correct?