2016-06-16 21 views
0

我有25個文件,我想用同樣的設置來處理它們,但對於下面的腳本,我收到兩個錯誤:運行ELKI自動

 

    **Stopping execution because of configuration errors. 
    optics.sh: line 9: -algorithm: command not found 
    optics.sh: line 14: -optics.minpts: command not found** 

 

    #!/bin/bash 
    for file in ~/ELKI/locationData/csv/*.csv; do 
     name=${file##*/}  
     java -jar ~/ELKI/elki.jar KDDCLIApplication \ 
     -dbc.in "$file" \ 
     -db.index tree.spatial.rstarvariants.rstar.RStarTreeFactory \ 
     -index.pagefile MemoryPageFileFactory -pagefile.pagesize 512 \ 
     -spatial.bulkstrategy SortTileRecursiveBulkSplit \ 
     -algorithm clustering.optics.OPTICSXi \ 
     -opticsxi.xi 0.05 \ 
     -algorithm.distancefunction geo.LatLngDistanceFunction \ 
     -geo.model SphericalHaversineEarthModel \ 
     -optics.epsilon 100.0 \ 
     -optics.minpts 200 \ 
     -resulthandler ResultWriter -out.gzip \ 
     -out ~/ELKI/locationData/output/${name%.*} 
    done 

我沒有使用bash太多的經驗,它可能是我的bash腳本中有錯誤。

+1

複製粘貼http://www.shellcheck.net/腳本,看來你有''\\在8號線和13 – Inian

+0

由於它解決了這個問題後的空間。 – user1124825

+0

樂意幫忙!始終使用上述網站來驗證腳本中的語法問題。 – Inian

回答

1

看起來你有一個空白行後的\字符在某些行中。如果反斜槓後有空格,轉義將應用於它們而不是換行符,並且該命令不會在下一行繼續。

# There are spaces after the backslash: 
$ echo hello \ 
hello 
$ world 
bash: world: command not found 

# No spaces after the backslash: 
$ echo hello \ 
> world 
hello world