gpt4 book ai didi

shell - Cygwin在shell脚本中找不到文件

转载 作者:行者123 更新时间:2023-12-02 03:33:04 24 4
gpt4 key购买 nike

我在 Cygwin 中运行 shell 脚本,并且 shell 脚本中的文件没有显示,即使它们肯定与 shell 脚本在同一目录中。

Cygwin 命令:

$ bash `cygpath --unix "C:\Users\myName\Documents\projectFile\dygraphsMaster\generate-combined.sh"`

Shell 脚本(来自 dygraphs.com):
#!/bin/bash
# Generates a single JS file that's easier to include.

GetSources () {
# This list needs to be kept in sync w/ the one in dygraph-dev.js
# and the one in jsTestDriver.conf. Order matters, except for the plugins.
for F in \
dashed-canvas.js \
dygraph-options.js \
dygraph-layout.js \
dygraph-canvas.js \
dygraph.js \
dygraph-utils.js \
dygraph-gviz.js \
dygraph-interaction-model.js \
dygraph-tickers.js \
dygraph-plugin-base.js \
plugins/*.js \
dygraph-plugin-install.js \
datahandler/datahandler.js \
datahandler/default.js \
datahandler/default-fractions.js \
datahandler/bars.js \
datahandler/bars-custom.js \
datahandler/bars-error.js \
datahandler/bars-fractions.js
do
echo "$F"
done
}

# Pack all the JS together.
CatSources () {
GetSources \
| xargs cat \
| perl -ne 'print unless m,REMOVE_FOR_COMBINED,..m,/REMOVE_FOR_COMBINED,'
}

Copyright () {
echo '/*! @license Copyright 2014 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */'
}

CatCompressed () {
Copyright
CatSources \
| grep -v '"use strict";' \
| node_modules/uglify-js/bin/uglifyjs -c warnings=false -m
}

ACTION="${1:-update}"
case "$ACTION" in
ls)
GetSources
;;
cat)
Copyright
CatSources
;;
compress*|cat_compress*)
CatCompressed
;;
update)
CatCompressed > dygraph-combined.js
chmod a+r dygraph-combined.js
;;
*)
echo >&2 "Unknown action '$ACTION'"
exit 1
;;
esac

最佳答案

执行这个时你在哪个目录?在与脚本本身相同的文件夹中?

你能试试这个吗:

cd /cygdrive/c/Users/myName/Documents/projectFile/dygraphsMaster/
./generate-combined.sh

关于shell - Cygwin在shell脚本中找不到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25492167/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com