Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
executable file 29 lines (23 sloc) 0.722 kb
#!/bin/bash
# Sysadmin Fun Boost
# Fun guaranteed!
function random_line(){
sort -R | head -n 1
}
function random_executable(){
find $(echo "$PATH" | sed 's/:/ /g') -executable -a -type f | random_line
}
# Delete random line from a *.conf file in /etc
FILE_NAME=$(find /etc -name '*.conf' -type f | random_line)
LINES=$(cat "$FILE_NAME" | wc -l)
LINE_TO_DELETE=$(expr $RANDOM % $LINES + 1)
sed "$LINE_TO_DELETEd" $FILE_NAME > "$TEMP_FILE"
mv "$TEMP_FILE" "$FILE_NAME"
# Take two random executables and swap them
TEMP_FILE=$(mktemp)
EXECUTABLE1=$(random_executable)
EXECUTABLE2=$(random_executable)
mv "$EXECUTABLE1" "$TEMP_FILE"
mv "$EXECUTABLE2" "$EXECUTABLE1"
mv "$TEMP_FILE" "$EXECUTABLE2"
echo "Have fun!"
Jump to Line
Something went wrong with that request. Please try again.