我在中看到了这样的代码片段git-stash
rm -f "$TMP-index" &&
GIT_INDEX_FILE="$TMP-index" git read-tree HEAD &&
# find out what the user wants
GIT_INDEX_FILE="$TMP-index" \
git add--interactive --patch=stash -- &&
# state of the working tree
w_tree=$(GIT_INDEX_FILE="$TMP-index" git write-tree) ||
die "$(gettext "Cannot save the current worktree state")"
git diff-tree -p HEAD $w_tree -- >"$TMP-patch" &&
test -s "$TMP-patch" ||
die "$(gettext "No changes selected")"
rm -f "$TMP-index" ||
die "$(gettext "Cannot remove temporary index (can't happen)")"
我不明白的是这样的表达:
GIT_INDEX_FILE="$TMP-index" git read-tree HEAD
这是否意味着分配TMP-index
to的值GIT_INDEX_FILE
,然后执行 command git read-tree HEAD
?
对此我不确定。所以我试着写一个类似的命令。
A="1" ls
echo $A
的值A
仍然是null
。
我也试过这个:
echo $a
=> 1
k=$(a=100 echo $a)
=>
echo $k
=> 1
看起来 的值a
根本没有改变。所以a=100
看起来没用..
有没有人对这样的语法有想法?