在Mac上(bash)写一个脚本,要求如下:
用户输入的文件名,若该文件不存在或是不可读,则显示错误信息
例如文件夹内存在名为" theinfile " 的文件,则屏幕上有以下输出
% ./exist.sh infile // 文件不存
"infile" does not exis
% ./exist.sh inputfile // 文件不存在
"inputfile" does not exist
% ./exist.sh theinfile // 文件存在
% ./exist.sh cannotreadfile // 文件不可读
cannot read "cannotreadfile"
跪求大神指点!谢谢!
用户输入的文件名,若该文件不存在或是不可读,则显示错误信息
例如文件夹内存在名为" theinfile " 的文件,则屏幕上有以下输出
% ./exist.sh infile // 文件不存
"infile" does not exis
% ./exist.sh inputfile // 文件不存在
"inputfile" does not exist
% ./exist.sh theinfile // 文件存在
% ./exist.sh cannotreadfile // 文件不可读
cannot read "cannotreadfile"
跪求大神指点!谢谢!