about summary refs log tree commit diff stats
path: root/src/nolink.sh
blob: b4d6c3e4e85a93178df6a17c75540cc85ac28b07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

unlinks=( $(grep -L '\[.*\]\[.*\]' *) )
total_things=$(ls | wc -l)

if [[ -n $1 && $1 == "-l" ]]; then
    echo ${unlinks[@]} | tr ' ' '\n'
else
    echo "${unlinks[$((RANDOM %= $((${#unlinks[@]}))))]}"
    echo "(${#unlinks[@]} of $total_things still to link.)"
fi


#[no link][]