我可以看到文件大小但无法打开文件

时间:2017-12-29 19:31:08

标签: file unix

我可以用MB格式文件大小,但当我尝试打开文件时,我无法说...无法找到文件。

while read line; do echo $line # or whaterver you want to do with the $line variable 
    cat $line | grep "PROCEDURE" > result3.txt
    chmod 777 result3.txt
done < xreflist.txt;

1 个答案:

答案 0 :(得分:1)

为了能够找到文件大小,您需要获得读取目录的权限。

为了能够打开文件,您需要获得读取文件的权限。

完全可以在没有其他人的情况下做到这一点。

$ mkdir junk
$ cd junk
$ echo "Hello World" > no-permission
$ chmod 0 no-permission
$ ls -la
total 8
drwxr-xr-x   3 jonathanleffler  staff   96 Dec 29 11:34 .
drwxr-xr-x  18 jonathanleffler  staff  576 Dec 29 11:34 ..
----------   1 jonathanleffler  staff   12 Dec 29 11:34 no-permission
$ cat ./no-permission
cat: ./no-permission: Permission denied
$ rm -f ./no-permission
$ cd ..
$ rmdir junk
$
相关问题