-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateday.sh
More file actions
executable file
·43 lines (37 loc) · 882 Bytes
/
createday.sh
File metadata and controls
executable file
·43 lines (37 loc) · 882 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
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Determine new folder based on input arguments
if [ $1 ]; then
NEW_DIR=day$1
else
NEW_DIR=day$(date +%d)
fi
# Create new dir
if [ -d "$NEW_DIR" ]; then
echo "Folder '$NEW_DIR' exists already"
else
mkdir "$NEW_DIR"
echo "Folder '$NEW_DIR' created"
fi
# Clone boilerplate
if [ -e "$NEW_DIR/solve.py" ]; then
echo "File '$NEW_DIR/solve.py' exists already"
else
cp ../boilerplate.py "$NEW_DIR/solve.py"
echo "File '$NEW_DIR/solve.py' created"
fi
# Test file
if [ -e "$NEW_DIR/test_one.txt" ]; then
echo "File '$NEW_DIR/test_one.txt' exists already"
else
touch "$NEW_DIR/test_one.txt"
echo "File '$NEW_DIR/test_one.txt' created"
fi
# Test file
if [ -e "$NEW_DIR/test_two.txt" ]; then
echo "File '$NEW_DIR/test_two.txt' exists already"
else
touch "$NEW_DIR/test_two.txt"
echo "File '$NEW_DIR/test_two.txt' created"
fi
# Done
echo "Finished"