问题描述
我运行Debian中8.1,GNU bash的版本30年3月4日(1) - 释放下(x86_64-PC-Linux的GNU)和联想G50-30 500 GB固态硬盘和8 GB闪存:
I run in Debian 8.1, GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu) and Lenovo G50-30 with 500 GB SSD and 8 GB flash memory:
shopt -s extglob
cp -r !(Backups.backupdb/) /home/masi/Documents/
但它也将一切从目录复制的 Backups.backupdb / 的证实在复印结束。
2小时后,复制
cp: cannot stat ‘Backups.backupdb/masi\’s MacBook Air/2015-06-25-233115/Macintosh HD/System/Library/Image Capture/Automatic Tasks/MakePDF.app/Contents/Resources/ko.lproj/3x5로 자르기.mkpdf’: No such file or directory
cp: cannot stat ‘Backups.backupdb/masi\’s MacBook Air/2015-06-25-233115/Macintosh HD/System/Library/Image Capture/Automatic Tasks/MakePDF.app/Contents/Resources/ko.lproj/3x5에 맞추기.mkpdf’: No such file or directory
...
cp: cannot stat ‘Camera Uploads/2015-06-29 11.51.36.jpg’: Invalid argument
cp: cannot stat ‘Camera Uploads/2015-06-29 11.51.53.jpg’: Invalid argument
cp: cannot stat ‘Camera Uploads/Icon\r’: Invalid argument
cp: cannot stat ‘Cancer’: Invalid argument
cp: cannot stat ‘cardio bad/atria-en-ventrikels.swf’: Invalid argument
cp: cannot stat ‘cardio bad/extreme_90_180.swf’: Invalid argument
cp: cannot stat ‘Cardio databases tools’: Invalid argument
cp: cannot stat ‘Cardiology’: Invalid argument
...
在这里我把意想不到的浏览通过备份文件夹。
这里的挑战是,Backups.backupdb是几TB的,看到了它去浏览它感觉并不好。
where I keep unexpected browsing through the backup folder.The challenge here is that the Backups.backupdb is several TBs and seeing that it goes browsing it does not feel good.
我运行
ls -lR /media/masi/eb807ed8-7f45-35f8-a345-9da6692b228a/ |grep Backup
获得
ls: cannot access /media/masi/eb807ed8-7f45-35f8-a345-9da6692b228a/Cancer: Invalid argument
ls: cannot access /media/masi/eb807ed8-7f45-35f8-a345-9da6692b228a/Cardio databases tools: Invalid argument
ls: cannot access /media/masi/eb807ed8-7f45-35f8-a345-9da6692b228a/Cardiology: Invalid argument
drwxr-xr-x 1 root root 7 Jul 8 20:25 Backups.backupdb
ls: cannot open directory /media/masi/eb807ed8-7f45-35f8-a345-9da6692b228a/animations/Embryology/e17_files: Permission denied
^C
所以目录不是一个符号链接。
为什么extglob情况除外通过浏览文件夹这里被打破?
so the directory is not a symlink.Why is extglob except condition broken here by browsing the folder?
推荐答案
尝试删除反斜杠(我添加用于测试目的回声):
Try removing the backslash (I am adding echo for test purposes):
shopt -s extglob
echo cp -r !(Backups.backupdb) /home/masi/Documents/
它工作在我的环境(GNU bash中,版本30年3月4日,OS X)
It works in my environment (GNU bash, version 4.3.30, OS X)
这篇关于为什么除了状态以外破extglob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!