Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
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 "{}"' \;