-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeC
More file actions
executable file
·39 lines (32 loc) · 950 Bytes
/
makeC
File metadata and controls
executable file
·39 lines (32 loc) · 950 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
#!/bin/bash
# Check if the 'list' file exists
if [ ! -e list ]; then
echo "The 'list' file does not exist."
exit 1
fi
# Read each line from 'list' file and create a new file
while IFS= read -r line; do
# Trim leading and trailing spaces from the line
line=$(echo "$line" | xargs)
# Check if the line is empty
if [ -z "$line" ]; then
continue
fi
# Create a new file with the corresponding name
filename="${line}"
echo "#include \"main.h\"" > "$filename"
echo "/**" >> "$filename"
echo " *" >> "$filename"
echo " * @" >> "$filename"
echo " * @" >> "$filename"
echo " * Return: nothing" >> "$filename"
echo " */" >> "$filename"
echo "void" >> "$filename"
echo "{" >> "$filename"
echo "" >> "$filename"
echo "return;" >> "$filename"
echo "}" >> "$filename"
# chmod 744 "$filename"
echo "Created file: $filename"
done < list
echo "All files created successfully."