我有一个我理解大部分的简单脚本,它是 find 命令不清楚。我有很多文档,但它并不能使它更清晰。我的想法是它像 for 循环一样工作,当前找到的文件被换入 {} 并复制到 $HOME/$dir_name,但是-path和-prune -o的搜索如何工作?拥有如此具体和相关的文档,但仍然不知道发生了什么,这很烦人。
#!/bin/bash
# The files will be search on from the user's home
# directory and can only be backed up to a directory
# within $HOME
read -p "Which file types do you want to backup " file_suffix
read -p "Which directory do you want to backup to " dir_name
# The next lines creates the directory if it does not exist
test -d $HOME/$dir_name || mkdir …
Run Code Online (Sandbox Code Playgroud) find ×1