-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc-teach
executable file
·48 lines (44 loc) · 1.08 KB
/
.bashrc-teach
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash -
init-asm()
{
root_dir=/mnt/co/work/teach/cmc/asm
if [ "$(pwd)" != $root_dir ]; then
echo "Wrong dir? Want to cd to $root_dir?"
select cont in yes no
do
case "$cont#$REPLY" in
"yes#"*|*"#yes")
cd $root_dir
break
;;
"no#"*|*"#no")
echo "Bye then."
exit 1
;;
*)
echo "Come again? (got $REPLY)"
continue
;;
esac
done
fi
[ -n "$1" ] && suf="-${1}"
dir="$(date -I)$suf"
mkdir -p "$dir"
realpath "$dir"
cd "$dir"
ln -sf ../io.inc
ln -sf ../build_asm.sh
ln -sf ../macro.c
ln -sf /mnt/co/books/sem/asm/intel386-psABI-1.1.pdf
__teach_save_PS1="$PS1"
export PS1='\[\033[01;32m\][\W]\[\033[00m\]$ '
}
deinit-asm()
{
if [ "-n" "$__teach_save_PS1" ]; then
export PS1="$__teach_save_PS1"
__teach_save_PS1=
fi
unset -f deinit-asm
}