All pastes #281091 Raw Edit

Someone

public shellscript v1 · immutable
#281091 ·published 2006-12-16 14:13 UTC
rendered paste body
#!/bin/bashcase "$1" in A|a)if [[ -f /tmp/channels ]]        #find freqence        then rm -rf /tmp/channlesfi## use frequence tablefor names in us-bcast us-cable us-cable-hrc us-cable-irc japan-bcast japan-cable europe-west europe-east italy newzealand australia ireland france china-bcast southafrica argentina australia-optusdoexec ivtv-tune -t$names -l |awk '{print $2}' >> /tmp/channelsdone## if thers duplicated freqences sort it out :)sort -u -o /tmp/channels /tmp/channelsecho "Please wait"#numbers of freqencesnumbers=`wc -l /tmp/channels |awk '{print $1}'`for ((i=1; i<="$numbers"; i++))do Channels[$i]=`cat /tmp/channels | sed -n ""$i"p"`        if [[ `ivtv-tune -f${Channels[$i]} | grep -c "De"` = "1" ]]        then echo "we got a signal @: ${Channels[$i]} Khz"        sleep 1        fidone;;        M|m)if [[ "$2" < "/dev/null" ]]        then echo -e "I need a min freq to start with\n Ex: $0 M 50000 800000"        exit 1;fiif [[ "$3" < "/dev/null" ]]        then echo -e "I need a max freq to stop at Ex: $0 M $2 800000"        exit 1;fiMIN_FREQ="$2"MAX_FREQ="$3"#make a freqence step of 250 Khzfor (( i="$MIN_FREQ" ; i<= "$MAX_FREQ" ; i+=250))do# make Khz to Mhzfreq=$(bc << EOFscale = 3($i/1000)EOF)## check if we got a signal detected with ivtv-tuneif [[ `ivtv-tune -f $freq | grep -c "De"` = "1" ]]        then echo "we got a signal @: ${i} Khz"fidone;;        *)        echo "use $0 A or $0 M";;