- 论坛徽章:
- 0
|
刚才看yes时,看到一个等效脚本,改了个no的
- #!/bin/bash
- # no.sh
- no ()
- { # Trivial emulation of "no" ...
- local DEFAULT_TEXT="no"
- while [ true ] # Endless loop.
- do
- if [ -z "$1" ]
- then
- echo "$DEFAULT_TEXT"
- else # If argument ...
- echo "$1" # ... expand and echo it.
- fi
- done # The only things missing are the
- }
- no
复制代码
测试一下
- [rockfall@localhost tmp]$ cp -i ../sor ./a.txt
- cp: overwrite `./a.txt'? y
- [rockfall@localhost tmp]$ more a.txt
- id:0,count:18,doc:10,CHI:9,info:9.3897866898
- id:1,count:2813,doc:1186,CHI:8.8059808988,info:9.5329395664
- id:2,count:2627,doc:1193,CHI:10.4851413849,info:9.3680302230
- [rockfall@localhost tmp]$ echo "">a.txt
- [rockfall@localhost tmp]$ more a.txt
- [rockfall@localhost tmp]$ ./no.sh|cp -i ../sor ./a.txt
- cp: overwrite `./a.txt'? [rockfall@localhost tmp]$ more a.txt
- [rockfall@localhost tmp]$
复制代码
好像还行
echo "n"|cp -i a/xx b/
[ 本帖最后由 haimming 于 2009-1-8 00:37 编辑 ] |
|