aboutsummaryrefslogtreecommitdiff
path: root/captain/sql/scan_instructions.sh
blob: dab98b3aa05e7d6b37e22bbb2866d7be2fab2ae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

cmds=`tempfile`
echo $cmds

for filename in $2/*.json; do
    # In case it doesn't exist
    [ -e "$filename" ] || continue
    name=${filename##*/}
    echo $name
    base=${name%.json}
    echo $base
    
    echo "INSERT OR IGNORE INTO instructions(name) VALUES('$base');" | cat >> $cmds
done

sqlite3 $1 < $cmds

rm $cmds