getsql.sh 673 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
#!/bin/bash
set -euo pipefail

if command -v apt-get >/dev/null 2>&1 ; then
	sudo apt-get install sqlite3
elif  command -v unzip >/dev/null 2>^1 ; then
	mkdir -p ~/bin
	curl https://www.sqlite.org/2019/sqlite-tools-win32-x86-3270200.zip > sql.zip
	unzip sql.zip
10
	mv sqlite-tools-win32-x86-3270200/* ~/bin/	
11
12
	rm -rf sqlite-tools-win32-x86-3270200
	echo 'export PATH="$PATH:$HOME/bin"' >> .bash_profile
13
	echo 'alias sqlite3="winpty sqlite3"' >> .bash_profile	
14
15
16
17
18
19
	source .bash_profile
	sqlite3 --version
	# 3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7
else
	echo "I cannot find apt or unzip. Please ask an instructor for help."
fi