-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitDay.sh
54 lines (43 loc) · 1.12 KB
/
initDay.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
47
48
49
50
51
52
53
54
#!/bin/bash
solutionPlaceHolder="
const { fileRowsToArray, sum, l } = require('../util');
const testIn =
'test';
const p1 = (input) => {
input = testIn;
const mapper = (r) => r;
const rows = fileRowsToArray(input, null, mapper);
const res = rows.length;
return res;
}
const p2 = (input) => {
input = testIn;
const mapper = (r) => r;
const rows = fileRowsToArray(input, null, mapper);
const res = rows.length;
return res;
}
module.exports = (input1, input2) => {
if (input1 != null) {
console.log('Sol 1:', p1(input1));
}
const in2 = input2?.length ? input2 : input1;
if (in2 != null) {
console.log('Sol 2:', p2(in2));
}
}
"
if [[ $1 =~ ^[0-9]+$ ]]; then
mkdir -p input
mkdir -p solutions
touch "input/day${1}_1.txt"
touch "input/day${1}_2.txt"
# Check if the day${1}.js file already exists
if [ ! -f "solutions/day${1}.js" ]; then
touch "solutions/day${1}.js"
echo "$solutionPlaceHolder" > "solutions/day${1}.js"
fi
else
# Print an error message if no number was provided
echo "Please provide day number as the first argument."
fi