summarylogtreecommitdiffstats
path: root/meow.sh
blob: a78cad71014d060c4c4acab79cffc46bfdbd8b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
python_script=$(cat <<'EOF'
import random

SEPARATOR = '[catseparator]'
FILE = '/etc/meow/cats.txt'

# read the file
with open(FILE, 'r') as f:
    content = f.read()

# split all the cats using the separator var
cats = content.split(SEPARATOR)

# say nuh uh to extra spaces
cats = [cat.rstrip() for cat in cats]

random_cat = random.choice(cats)
print(random_cat, end='')
EOF
)

ascii_cat=$(python3 -c "$python_script")
echo "$ascii_cat"