我正在尝试将目录更改为git存储库的远程位置。我使用的命令是:
cd ${$(git remote get-url origin)%.git}该命令不起作用:
bash: ${$(git remote get-url origin)%.git}: bad substitution我不明白为什么这不对。是因为$()而不是使用变量名吗?如果是,为什么?我怎么才能正确地做这件事?
发布于 2017-10-15 10:09:30
不能在bash中使用嵌套字符串替换。
相反,您可以使用以下一行:
cd $(git remote get-url origin | sed 's/\.git$//')https://stackoverflow.com/questions/46753831
复制相似问题