![](/img/trans.png)
[英]What do the double curly braces in Flask mean when surrounding a function?
[英]What do double curly braces do in a bash command?
我正在重構一個腳本,我看到了這個:
/bin/bash -c 'rm -rf directory/{{..?*,.[!.]*,*}}'
奇怪的是,到目前為止,谷歌搜索“bash 雙花括號”並沒有讓我找到任何地方。 這段代碼有什么作用?
編輯:顯然,我沒有包含足夠的細節。 它實際上是一個使用format()
的 python 命令,所以雙花括號實際上是單花括號被轉義。
subprocess.check_output(['/bin/bash', '-c', 'rm -rf {0}/{{..?*,.[!.]*,*}}'.format('directory')]
@thatotherguy 在評論中指出了這一點。
例如,有時在 GitLab 或 GitHub 運行器中傳遞 bash 腳本時會出現雙卷曲
- name: Set selected color
run: echo '::set-output name=SELECTED_COLOR::green'
id: random-color-generator
- name: Get color
run: echo "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}"
https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.