Skip to content

Instantly share code, notes, and snippets.

@kvpb
Last active July 28, 2022 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvpb/69070290b64f186d349d81ee1a7a0e9d to your computer and use it in GitHub Desktop.
Save kvpb/69070290b64f186d349d81ee1a7a0e9d to your computer and use it in GitHub Desktop.
Test Script 71: BASH pseudorandom brute-forcing
#!/usr/bin/env bash
mkdir directory && cd directory
for i in {0..99}
do
> file${i}
printf "make file${i}\n"
done #for i in {0..0}{0..9}{0..9}; do > file${i}; echo file${i}; done
i=0
while [ ${i} -le 10 ]
do
printf "delete "
rm -v file$[RANDOM%99+1]
i=$(expr ${i} + 1)
done
n=$[RANDOM%99+1] &&
while [ -e file${n} ]
do
printf "file${n} exists\n"
n=$[RANDOM%99+1]
printf "n=${n}\n"
done
# script71.sh
# Test Script 71: BASH pseudorandom brute-forcing
#
# Author: Karl V. P. Bertin `kvpb`
# Telephone: +33 A BB BB BB BB
# Email: local-part@domain
# LinkedIn: https://www.linkedin.com/in/karlbertin
# Facebook: https://www.facebook.com/profile.php?id=
# Instagram: https://www.instagram.com/karlbertin/
# Snapchat: https://www.snapchat.com/add/karlbertin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment