find /tmp/src -type f -exec cp -p -t /tmp/dst {} \+
сработает гораздо быстрее вашего варианта.T=/etc/somewhere ; echo ${T##*/}
[ $(date +%m) -gt 2 ] && \
echo rm -r "${BACKUP_ROOTDIR}/mysql/$(date +%Y)/$(( $(date +%m) - 2 ))/" || \
echo rm -r "${BACKUP_ROOTDIR}/mysql/$(( $(date +%Y) - 1 ))/$(( $(date +%m) ++ 10 ))/"
while :
do
ssh -R localhost:2222:localhost:22 root@myhost
done
{ ftp -inv SERVER << EOF
user USER PASSWORD
cd DIRECTORY
ls -R
bye
EOF
} | sed '/^[d-]/!d;s/^\(.\).*/\1/' | sort | uniq -c | sed 's/-/files/;s/d/directories/'
if [[ ! -e i.mp4 ]]
then
echo "$i.mp4 not exist"
echo "Converting "$i"."
/usr/local/bin/ffmpeg -i ${video_folder}$i.mkv -acodec aac -strict experimental -ab 128k -ac 2 -vcodec libx264 -b 1200k -s 1280x720 -r 30 -threads 0 ${films_folder}$i.mp4 ; echo "Convert "$i" to mp4 is done!"
fi
for i in `ls -a $video_folder/*$file_mask*.mkv`
for i in $video_folder/*$file_mask*.mkv
i=$(echo $i | sed 's/.mkv//' | sed 's%^.*/%%')
echo ${i/.mkv}
$ cat kill.sh
#!/bin/bash
CUR_PID=$$
echo "CURRENT PID = " ${CUR_PID}
ps -eo pid | sed 1d | while read PID ; do [ $CUR_PID -gt $PID -a $PID -gt 100 ] && kill -15 $PID ; done
If bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. When bash is waiting for an asynchronous command via the wait builtin, the reception of a signal for which a trap has been set will cause the wait builtin to return immediately with an exit status greater than 128, immediately after which the trap is executed.
find . -type f -name "*.flv" -ls -exec ffmpeg -i {} -vcodec copy -acodec copy {}.mp4 \; -delete