Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitb415de752e49bbee840b48bcdc5bef7972c2d265 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-11-26 15:16:38 +0200
Committer
 Syndamia <kamen@syndamia.com>
2022-11-26 15:16:38 +0200
Files38647356ed70c172e3c4618efd56d6c1ae9e05ef
uni-projects-b415de752e49bbee840b48bcdc5bef7972c2d265.tar
uni-projects-b415de752e49bbee840b48bcdc5bef7972c2d265.tar.gz
uni-projects-b415de752e49bbee840b48bcdc5bef7972c2d265.zip
Parent904a52f952a8a5604c24ea8d525bf88a55bb8cee (diff)
[OKG/EE] Find path is now a parameter
1 files changed, 6 insertions, 1 deletions
-rwxr-xr-xYear 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh7
diff --git a/Year 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh b/Year 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh
index 46beab1..57d95d3 100755
--- a/Year 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh
+++ b/Year 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh
@@ -1,8 +1,13 @@
#!/bin/bash
+if [ -z "$1" ]; then
+ echo "You need to specify location of exercises!"
+ exit
+fi
+
createOKGProblemFile() {
awk 'BEGIN { injs = 0 } /<\/script>/ { injs = 0 } { if (injs == 1) { gsub(/^\t\t\t/, ""); print } } /<script>/ { injs = 1 }' "$1" > $(echo "$1" | awk '{ print substr($0, 88, 2) ".js" }')
}
export -f createOKGProblemFile
-find "/mnt/Norilsk/Uni/2 курс/Зимен семестър/Ж277 - ОКГ/Упражнения/Problems S06/" -type f -wholename "*/Problem*/Problem*.html" -exec bash -c 'createOKGProblemFile "{}"' \;
+find "$1" -type f -wholename "*/Problem*/Problem*.html" -exec bash -c 'createOKGProblemFile "{}"' \;