File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/script/webgraph_ranking Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,31 @@ if ! shift 3; then
8
8
exit 1
9
9
fi
10
10
11
+ if ! [[ " $NAME " =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]+[a-zA-Z0-9_]$ ]]; then
12
+ echo " Graph <name> should only contain [a-zA-Z0-9_.-] and start and end with [a-zA-Z0-9_]."
13
+ echo " The graph name '$NAME ' might not be safe as a graph base name (without suffix)"
14
+ echo " or directory name to place the graph files into. Exiting..."
15
+ exit 1
16
+ fi
17
+
11
18
OUTPUTDIR=" $NAME "
12
19
if [ -n " $1 " ]; then
13
20
OUTPUTDIR=" $1 "
14
21
shift
22
+ case " $OUTPUTDIR " in
23
+ * " " * )
24
+ echo " The output directory <output_dir> must not contain white space. Exiting..."
25
+ exit 1
26
+ ;;
27
+ esac
15
28
fi
16
29
FULLNAME=" $OUTPUTDIR /$NAME "
17
30
31
+
32
+ set -e # fail if creation of output directory fails
33
+
18
34
if [ -d " $OUTPUTDIR " ]; then
19
- # TODO: OUTPUTDIR must not contain whitespace, '/', etc.
20
35
echo " Output directory $OUTPUTDIR / exists"
21
- # exit 1
22
36
else
23
37
mkdir " $OUTPUTDIR "
24
38
fi
You can’t perform that action at this time.
0 commit comments