我正在运行一个非常简单的脚本来提取存储在文本文件中的多个存储库。在更新Git之前运行正常。现在我得到一个没有这样的文件或目录'每个存储库的错误。如果我将目录硬编码到脚本中,它运行正常。
这是脚本:
filename="../Repositories/all.txt"
echo "Starting list"
printf "\n"
filelines=`cat $filename`
for line in $filelines ; do
if
[[ $line != !* ]];
then
printf "\n"
echo $line
repopath=${line:19}
echo $repopath
fullpath=/c/DevSource/Tamu/GeoInnovation/$repopath
echo $fullpath
#cd /c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core
cd $fullpath
git pull
fi
done
这是运行bash -x pullallrepos.sh
时的输出+ for line in '$filelines'
!= !* ]].GeoInnovation.AddressProcessing.Core
+ printf '\n'
+ echo $'Tamu.GeoInnovation.AddressProcessing.Core\r'
Tamu.GeoInnovation.AddressProcessing.Core
+ repopath=$'AddressProcessing.Core\r'
+ echo $'AddressProcessing.Core\r'
AddressProcessing.Core
+ fullpath=$'/c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core\r'
+ echo $'/c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core\r'
/c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core
+ cd $'/c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core\r'
: No such file or directoryd: /c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core
+ git pull
Updating 4ad72a9..0c00ac0
如果我在这里硬编码路径:
cd /c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core
#cd $fullpath
运行良好:
+ echo $'Tamu.GeoInnovation.AddressProcessing.Core\r'
Tamu.GeoInnovation.AddressProcessing.Core
+ repopath=$'AddressProcessing.Core\r'
+ echo $'AddressProcessing.Core\r'
AddressProcessing.Core
+ fullpath=$'/c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core\r'
+ echo $'/c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core\r'
/c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core
+ cd /c/DevSource/Tamu/GeoInnovation/AddressProcessing.Core
+ git pull
Already up-to-date.
我觉得我错过了一些非常简单的东西,但对于我的生活,我无法找到它。