GITUSER=$(whoami); curl "https://api.github.com/users/${GITUSER}/starred?per_page=1000" | grep -o 'git@[^"]*' | xargs -L1 git clone
命令用途:从 Github 备份所有已加星标的存储库
花括号扩展
GITUSER=$(whoami); curl "https://api.github.com/users/${GITUSER}/starred?per_page=1000" | grep -o 'git@[^"]*' | xargs -L1 git clone 利用 Bash 的花括号扩展(Brace Expansion)功能。
花括号中的内容会被展开为多个参数:
GITUSER=$(whoami); curl "https://api.github.com/users/$GITUSER/starred?per_page=1000" | grep -o 'git@[^"]*' | xargs -L1 git clone
评论(0)
发表评论