sud*_*dus 34
您可以使用testshell的命令bash。
$ test -e ~/.bashrc && echo file exists || echo file not found
file exists
$ test -e ~/.bashrcx && echo file exists || echo file not found
file not found
Run Code Online (Sandbox Code Playgroud)
命令
help test
Run Code Online (Sandbox Code Playgroud)
打印具有不同选项的帮助文本,您可以将其与test命令一起使用。
您可能还会发现以下帮助文本很有用,以及@dessert 评论中的链接,
help [
Run Code Online (Sandbox Code Playgroud)
和
help [[
Run Code Online (Sandbox Code Playgroud)
find如果您不知道文件在哪里(因此您必须在多个目录中搜索它)或者您想查找文件的不同版本,您可以使用该命令。
$ sudo find / -name .bashrc
[sudo] password for sudodus:
/etc/skel/.bashrc
/root/.bashrc
find: ”/run/user/1002/gvfs”: Permission denied
/media/multimed-2/test/test/2015-04/colour-prompt/home/guru/.bashrc
/media/multimed-2/test/test/2015-04/colour-prompt/root/.bashrc
/media/multimed-2/test/test/2015-04/colour-prompt/etc/skel/.bashrc
/media/multimed-2/rsync-bup/nio/.bashrc
/home/lfs/.bashrc
/home/myself/.bashrc
/home/nio/.bashrc
/home/sudodus/.bashrc
Run Code Online (Sandbox Code Playgroud)