Download code

Jump to: navigation, search

Back to Carpet_fishing_(sh)

Download for Windows: single file, zip

Download for UNIX: single file, zip, tar.gz, tar.bz2

carpetfish.sh

 1 # The authors of this work have released all rights to it and placed it
 2 # in the public domain under the Creative Commons CC0 1.0 waiver
 3 # (http://creativecommons.org/publicdomain/zero/1.0/).
 4 # 
 5 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 6 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 7 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 8 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 9 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
11 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 # 
13 # Retrieved from: http://en.literateprograms.org/Carpet_fishing_(sh)?oldid=18668
14 
15 fish=${FISH:-"salmon trout catfish bass sturgeon crappie shad"} # species
16 time=${TIME:-60}                                                # time quantum
17 grid=${GRID:-36}                                                # grid size
18 
19 while true; do
20         sleep $((TIME*(30 + $RANDOM % 60)))
21 	species=$(echo $fish | awk '{print $(1+('$RANDOM' % NF))}')@ text
22 
23 	if [ X$species != Xsalmon ]; then
24 	        echo $species nibbling in area $(($RANDOM % $grid))@ text
25 
26 	else
27 	        echo $species running in areas: $(
28 		        for i in 0 1 2 3 4 5 6; do
29 		               echo $(($RANDOM % $grid))
30 		        done | sort -n | uniq)@ text
31 
32 	fi@ text
33 
34 done


hijacker
hijacker
hijacker
hijacker