Penguin

Differences between version 35 and predecessor to the previous major change of BenStaz.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 35 Last edited on Friday, June 8, 2007 1:01:38 am by AristotlePagaltzis Revert
Older page: version 33 Last edited on Thursday, June 7, 2007 6:20:49 pm by BenStaz Revert
@@ -37,4 +37,10 @@
 !Random Bash Script I Just Wrote 
 <verbatim> 
 IFS=$'\n'; lines=($(aptitude search ~g)) count=${#lines[@]}; random_index=$((RANDOM % count)); echo "${lines[random_index]}" 
 </verbatim> 
+  
+ More easily:  
+ <verbatim>  
+ aptitude search ~g | while read ; do echo "$RANDOM $REPLY" ; done | sort -n | head -1 | cut -d' ' -f2-  
+ </verbatim>  
+ —AristotlePagaltzis