Advertisement
Guest User

01-random-art

a guest
Jun 16th, 2025
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. ART_FOLDER="/usr/share/motd-art"
  4. if [ ! -d "$ART_FOLDER" ]; then
  5.     echo "Error: ASCII art folder not found at $ART_FOLDER"
  6.     exit 0
  7. fi
  8. FILE_COUNT=$(find "$ART_FOLDER" -type f | wc -l)
  9. if [ "$FILE_COUNT" -eq 0 ]; then
  10.     echo "No ASCII art files found in $ART_FOLDER"
  11.     exit 0
  12. fi
  13. RANDOM_FILE=$(find "$ART_FOLDER" -type f | shuf -n 1)
  14. if [ -f "$RANDOM_FILE" ]; then
  15.     echo -e "$(cat "$RANDOM_FILE")"
  16. fi
  17. exit 0
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement