I just discovered this useful bit of code on this useful-looking website.
#!/bin/sh
exec tclsh "$0" ${1+"$@"}
proc main {} {
set lines [lrange [split [read stdin] \n] 0 end-1]
set count [llength $lines]
for {set idx_1 0} {$idx_1 < $count} {incr idx_1} {
set idx_2 [expr {int($count * rand())}]
set temp [lindex $lines $idx_1]
lset lines $idx_1 [lindex $lines $idx_2]
lset lines $idx_2 $temp
}
puts [join $lines \n]
}
main
Unfortunately, I don't like scripts. If I can, I make bash
functions instead. (I've even gone so far as to completely obfuscate Python scripts in order to fit them into my ~/.bashrc unobtrusively, viz:)
dna-ify () {
python -c "exec'eJxdkUFrhDAQhe/5FdNsIQpu9rIspSBtLz330N4EiTq6AY0hiaW7v75j1F1aLwlv3vdmMu4eDpN3h0qbA5pvsJdwHg3bQT022nT51+f7/omx1o0DlGU7hclhWYIe7OgCWKdNINXUQRO1qsp1VjmPGfiLz6BSHk/HDNAsmZ6xWHaQ36zyzXXTgCZ8xEqSrhapmqZUay0Rre7RqAFFBoZUn4sXkbL5RlkrEY+Z8ZSi27mFlxv4zIA+H2jujpDRokn+GFLpUDVEYk+sGcP8BukDDS61VyFckvRfyN1wQ/3aaBsprumMvaUqu97JeJFxMZiIa68res61uhmW1cnqdFw9K0spMRMSvvww2NdQcPzBuhA8gy0iA14I2WBkC7HEFSK9S3NPEgoOj68EerQ55yn7BbL1snM='.decode('base64').decode('zlib')" $@
}
So, is there any (and, as the above sample should indicate, I do mean any) way I can do that with this bit of code?
mv
command.