我正在尝试从其源代码构建Cytoscape。当我运行./cy.sh init时,出现以下错误:
$ ./cy.sh init
Target directory =
Cytoscape project will be cloned to: /mnt/c/Users/My Name/Documents/research/cytoscape
./cy.sh: line 186: cd: too many arguments
Could not find target directory: /mnt/c/Users/My Name/Documents/research/cytoscape
我意识到这正在发生,因为目录路径中有一个空格,而cd认为这是两个参数。我对bash脚本知之甚少,所以我不确定如何调整脚本,因此使用带空格的目录路径就可以了。这是相关代码:
172 function init {
173 # By default, clone everything in current directory.
174
175 echo "Target directory = $TARGET_DIR"
176
177 if [[ -z "$TARGET_DIR" ]]; then
178 TARGET_DIR=$(pwd)
179 elif ! [ -e "$TARGET_DIR" ]; then
180 echo "No such dir: $TARGET_DIR"
181 exit 1
182 fi
183
184 echo "Cytoscape project will be cloned to: ${TARGET_DIR}"
185
186 cd $TARGET_DIR || { echo Could not find target directory: $TARGET_DIR; exit 1;
}