-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.sh
46 lines (42 loc) · 864 Bytes
/
functions.sh
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
# Check if folder $1 exists and echo $2 if not
directory_exists() {
if [[ ! -d "$1" ]]; then
echo "$2"
return 1
else
return 0
fi
}
# Check if file $1 exists and echo $2 if not
file_exists() {
if [[ ! -e "$1" ]]; then
echo "$2"
return 1
else
return 0
fi
}
# Check if $1 runs and returns with 0 status
is_runnable() {
if which $1; then
return 0
else
echo "$2"
return 1
fi
}
# Wait until VM with name $1 powers down
wait_vm_quit() {
echo "Waiting $1 to power-off"
while [ `vboxmanage list runningvms | grep "$1" | wc -l` == "1" ]; do
echo -n "."
sleep 5
done
echo "...and it's gone"
}
shout() {
echo
echo $(date) :: $1
echo "========================================================================"
echo
}