-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreplit.sh
More file actions
executable file
·34 lines (23 loc) · 614 Bytes
/
replit.sh
File metadata and controls
executable file
·34 lines (23 loc) · 614 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
chr() {
[ "$1" -lt 256 ] || return 1
printf "\\$(printf '%03o' "$1")"
}
ord() {
LC_CTYPE=C printf '%d' "'$1"
}
DEMOS=(Blank Hello Chatroom Notes TodoMVC)
export DEMOS_AMOUNT=${#DEMOS[@]}
CONT=true
while [ "$CONT" == "true" ]
do
echo
for i in "${!DEMOS[@]}"
do
printf "%s: %s\n" "$(chr $((97 + $i )))" "${DEMOS[$i]}"
done
echo -n -e "\nChoose demonstration to launch ('a'…'$(chr $((96 + $DEMOS_AMOUNT)))'): "
read DEMO
export FILE=${DEMOS[$(($(ord $DEMO) - 97))]}
[ -f examples/$FILE/main.rb ] && cd examples && CONT=false && ruby -I../atlastk $FILE/main.rb
done