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