2
任何人都知道爲什麼此代碼無法按預期工作?Bash:無法在管道右側建立陣列
$> svnTags=()
$> svn ls http://plugins.svn.wordpress.org/duplicate-post/tags/ | while read line; do slashless=$(sed 's#/$##g' <<< $line); echo "slashless - $slashless"; svnTags+=($slashless); done
slashless - 1.0
slashless - 1.1
slashless - 1.1.1
slashless - 1.1.2
slashless - 2.0
slashless - 2.0.1
slashless - 2.0.2
slashless - 2.1
slashless - 2.1.1
slashless - 2.2
slashless - 2.3
$> echo "$svnTags[@]"
沒有給出任何輸出,我期待它輸出svn標記的內置數組。
第二個命令爆發:
svn ls http://plugins.svn.wordpress.org/duplicate-post/tags/ | while read line; do
slashless=$(sed 's#/$##g' <<< $line)
echo "slashless - $slashless"
svnTags+=($slashless)
done