2010-07-15 23 views
1

轉義字符*轉義字符*在cshell別名cshell別名

我想寫的是C Shell別名可以找到以一個模式

即 發現的等同文件。 -name「pattern *」

myfind pattern 應該在cmd上面做,其中myfind是別名。我如何逃避*在csh別名?

別名myfind'查找。 -name!**'

回答

1

你不需要逃跑。這種工作方式 -

alias myfind "find . -name 'pattern*'" 
+0

單引號都或多或少相當於逃逸。 – 2010-07-15 14:41:31

+0

同意。我應該說「不需要逃跑」*的具體「 – Gopi 2010-07-16 04:35:52

0
# the above post doesn't take into account \* arguments (including spaces in arguments) 


# The original alias is useful for when you have time to type quotes or your 
# arguments need to be regular expressions 
alias ff 'find . -iname \!* -follow -print' 

# alias fff (below) is of limited utility, because your arguments can't be regular 
# expressions or enclosed in quotes. It is useful for quick and dirty situations 
# when you want to cut and paste things with spaces in them without using quotes. 
# the combination of double quotes and single quotes here is very important. 
# rules of thumb for "I hate typing quotes" style aliases: 
# enclose alias arguments \* in this construct: '"\*"' 
# conversely, enclose wildcards in this construct: "'*'" 
alias fff "find . -iname '*'"'"\!*"'"'*' -follow -print" 

例子在提示

/Projects/mbox/Installers/Mbox Studio Installer>alias ff 
find . -iname !* -follow -print 
/Projects/mbox/Installers/Mbox Studio Installer>ff "Mbox *.app" 
./ROOT/Applications/Mbox Studio/Mbox Remote.app 
./ROOT/Applications/Mbox Studio/Mbox Studio.app 
./ROOT/Applications/Mbox Utilities/Mbox Controller.app 
/Projects/mbox/Console>alias fff 
find . -iname '*'"!*"'*' -follow -print 
/Projects/mbox/Installers/Mbox Studio Installer>fff Mbox Studio 
./NightlyBuild/DiskImages/Mbox Studio 3.6D3435.dmg 
./NightlyBuild/DiskImages/Mbox Studio 3.6D3438.dmg 
./ROOT/Applications/Mbox Studio 
./ROOT/Applications/Mbox Studio/Mbox Studio.app