1- #! /bin/bash
2- if [ $# == 0 ]
3- then
4- echo " Make a concore study "
1+ #! /usr/ bin/env bash
2+
3+ if [ " $# " -eq 0 ] ; then
4+ echo " Make a concore study"
55 echo " ./makestudy path/name.graphml"
66 echo " ./makestudy path/name.graphml study"
77 echo " In the first case, the name of the study is the same as the name of the .graphml"
88 echo " In either case, source files come from the same path as the .graphml"
99 echo " The equivalent mkconcore.py is displayed"
1010 exit
1111fi
12- graphml=$1
13- if [ -e $graphml ]
14- then
15- sourcedir=$( dirname " $graphml " )
12+
13+ graphml=" $1 "
14+
15+ if [ -e " $graphml " ]; then
16+ sourcedir=" $( dirname " $graphml " ) "
1617else
17- graphml=$graphml ' .graphml'
18- if [ -e $graphml ]
19- then
20- sourcedir=$( dirname " $graphml " )
18+ graphml=" ${graphml} .graphml"
19+ if [ -e " $graphml " ]; then
20+ sourcedir=" $( dirname " $graphml " ) "
2121 else
2222 echo " $graphml does not exist"
2323 exit
2424 fi
2525fi
26- if [ $# = 1 ]
27- then
28- studydir=` basename ${graphml% \ .* } `
26+
27+ if [ " $# " -eq 1 ] ; then
28+ studydir=" $( basename " ${graphml% .* } " ) "
2929else
30- studydir=$2
30+ studydir=" $2 "
3131fi
32- if [ -e $studydir ]
33- then
34- echo " cannot make $studydir because one already exists with that name"
35- echo " either do ./destroy $studydir , or choose a unique name as 2nd arg"
32+
33+ if [ -e " $studydir " ]; then
34+ echo " Cannot make $studydir because one already exists with that name"
35+ echo " Either do ./destroy $studydir , or choose a unique name as 2nd arg"
36+ exit
3637else
37- which osascript > /dev/null
38- if [ $? == 0 ]
39- then
40- echo " python3 mkconcore.py $graphml $sourcedir $studydir macos"
41- python3 mkconcore.py $graphml $sourcedir $studydir macos
38+ if command -v osascript > /dev/null; then
39+ echo " python3 mkconcore.py \" $graphml \" \" $sourcedir \" \" $studydir \" macos"
40+ python3 mkconcore.py " $graphml " " $sourcedir " " $studydir " macos
4241 else
43- echo " python3 mkconcore.py $graphml $sourcedir $studydir ubuntu"
44- python3 mkconcore.py $graphml $sourcedir $studydir ubuntu
42+ echo " python3 mkconcore.py \" $graphml \" \" $sourcedir \" \" $studydir \" ubuntu"
43+ python3 mkconcore.py " $graphml " " $sourcedir " " $studydir " ubuntu
4544 fi
46- fi
45+ fi
0 commit comments