mirror of
https://github.com/jhechavarria/say.sh.git
synced 2025-12-10 14:16:59 +00:00
securisation de la commande say
This commit is contained in:
12
say.sh
12
say.sh
@@ -132,14 +132,14 @@ say ()
|
|||||||
cfg=`cat $CFGPATH`;
|
cfg=`cat $CFGPATH`;
|
||||||
IFS=', ' read -r -a cfg <<< "$cfg";
|
IFS=', ' read -r -a cfg <<< "$cfg";
|
||||||
text=( "$@" );
|
text=( "$@" );
|
||||||
if [ $# -ge 2 -a -f $2 ]; then
|
if [ $# -ge 2 ]; then
|
||||||
|
if [ -f $2 ]; then
|
||||||
unset text[1];
|
unset text[1];
|
||||||
tmp=`cat $2`;
|
tmp=`cat $2`;
|
||||||
text=( "${text[@]}" "${tmp[@]}" );
|
text=( "${text[@]}" "${tmp[@]}" );
|
||||||
fi
|
fi
|
||||||
if [ -t 0 ]; then
|
fi
|
||||||
echo "Interactive Mode";
|
if [ ! -t 0 ]; then
|
||||||
else
|
|
||||||
while read -a line; do
|
while read -a line; do
|
||||||
text=( "${text[@]}" "${line[@]}" );
|
text=( "${text[@]}" "${line[@]}" );
|
||||||
done
|
done
|
||||||
@@ -149,6 +149,10 @@ say ()
|
|||||||
cfg[0]=$1;
|
cfg[0]=$1;
|
||||||
unset text[0];
|
unset text[0];
|
||||||
fi
|
fi
|
||||||
|
if [ `echo "${text[*]}" | wc -c` -eq 1 ]; then
|
||||||
|
echo "Give me something to say!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
pico2wave -l ${cfg[0]} -w $SNDPATH "${text[*]}";
|
pico2wave -l ${cfg[0]} -w $SNDPATH "${text[*]}";
|
||||||
play $SNDPATH vol ${cfg[1]} speed ${cfg[2]};
|
play $SNDPATH vol ${cfg[1]} speed ${cfg[2]};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user