I have created a small script to move video files from a helmet mounted camera to my mythbuntu machine and there is a variable that for some reason will just not be passed onto the script. The variable in question is
d=`echo $file | awk '{ print $6 }'`
which is captured OK, however in the statement
scp -l 5000 $name $SavePath$d_$hour.AVI
will just not insert a value.
#!/bin/bash
# This script does copy files from /media/disk/DCIM/100DSCIM to
# 192.20.0.200:/media/Elements/mythtv/videos/BikeRiding and renames the files using the time stamp
set -x
SavePath=root@198.20.0.200:/media/Elements/mythtv/videos/BikeRiding/
SourcePath=/media/disk/DCIM/100DSCIM/
ls $SourcePath*.AVI --full-time > file_list
cat file_list | while read file
do
d=`echo $file | awk '{ print $6 }'`
hour=`echo $file | awk '{ print $7 }'`
name=`echo $file | awk '{ print $9 }'`
scp -l 5000 $name $SavePath$d_$hour.AVI
done