ubuntu - bash iterate a list to make a channel hopping -
i want iterate list make channel hopping. value $channel correct in iteration "iw dev" command not getting correct value of $channel.
channellist=(1 3 6 11) while : channel in "${channellist[@]}" sudo iw dev mon0 set channel $channel echo "$channel" done done
this result in channel switching fast possible unsure if intended. there may not enough time other processes accurately collect data:
$ channellist=(1 3 6 11) $ while : > > channel in "${channellist[@]}" > > time echo command set channel $channel > echo "$channel" > sleep 1 > done > done command set channel 1 real 0m0.000s user 0m0.000s sys 0m0.000s 1 command set channel 3 real 0m0.000s user 0m0.000s sys 0m0.000s 3 command set channel 6 real 0m0.000s user 0m0.000s sys 0m0.000s 6 command set channel 11 real 0m0.000s user 0m0.000s sys 0m0.000s 11 command set channel 1 real 0m0.000s user 0m0.000s sys 0m0.000s 1 ^c $ edit:
as can see above information commands ran under 0.0005 s granted echo might lot faster sudo iw still fractions of second.
Comments
Post a Comment