有些東西我并沒有真正得到:
touch a b c ; mkdir -p git ; mkdir -p iii/ooo/ppp ; touch git/rtdsfgsdg ; touch .sdfsadf
那么,這是否產生了我想要的結果?
? tree -a
.
├── a
├── b
├── c
├── git
│ └── rtdsfgsdg
├── iii
│ └── ooo
│ └── ppp
└── .sdfsadf
4 directories, 5 files
是的。一些檔案,一個目錄,一個隱藏檔案。都好。
現在我想洗掉所有內容,但我想保留隱藏檔案和git目錄。GLOBIGNORE救援!
GLOBIGNORE=git rm -rf *
進展如何?
? tree -a
.
└── .sdfsadf
0 directories, 1 file
簡直太可怕了。git我的檔案夾在哪里?為什么GLOBIGNORE沒有像宣傳的那樣作業?
GLOBIGNORE
A colon-separated list of patterns defining the set of file
names to be ignored by pathname expansion. If a file name
matched by a pathname expansion pattern also matches one of the
patterns in GLOBIGNORE, it is removed from the list of matches.
我在:
? bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3 : GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
uj5u.com熱心網友回復:
您用于臨時應用變數的語法僅適用于執行時,而不適用于決議時;因此,它無法更改 glob 的擴展方式,因為在呼叫之前將 替換*為檔案串列。rm
要修改決議時行為,請拆分為兩個單獨的命令:
GLOBIGNORE=git
rm -rf *
在https://replit.com/@CharlesDuffy2/LovablePoliticalPrograms看到這個成功運行
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/432626.html
標籤:重击
