Miten muokkaan bach script,jotta webcam script:iä tulostaa juoksevan numeroinin?
#!/bin/bash
#A short script to download timed snapshots of a file that undergoes regular updates.
#The url of the file
url="
http://192.168.1.***:**/snapshot.cgi?user****s&pwd=*******&next_url=kamera2.jpg"
#This expression extracts the suffix part of the url from the url
suffixpart=${url##*.}
#The interval at which the file is fetched.
#N.B. Some sites may not take kindly to short intervals.
interval=5s
#Determine which command should be used for downloading given the current platform.
systemname=`uname -s || uname`
case $systemname in
*Linux)
cmd="wget $url -O"
;;
*Darwin)
cmd="curl $url -o"
;;
*)
cmd="wget $url -O"
;;
esac
#send file direction.
cd /home/webcam/web_camera/
#Infinite loop that does the downloading.
#The script must manually be interrupted to halt.
while [ 1 ]
do
datepart=`date "+webcam"`
$cmd $datepart.$suffixpart
exit
done
tai miten muokkaan tätä copy.bach tiestoa jotta kopio kuvissa on juoksevat numerot
#!/bin/bash
image=( mattiulko.jpg )
MAX=${#image
for i in ${image
do
num=${i:5:3} # grab the digits
compliment=$(printf '%00d' $(echo $MAX-$num | bc))
ln $i copy_of_image$compliment.jpg
done
jari169