我编写了一个脚本将文件发送到垃圾文件夹......
echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)"
read ans
case "$ans" in
Yes) echo "$(readlink -f "$1")" >> "$HOME/TrashLog" && mv "$1" "$HOME/my-documents/mydir01/Trash" ;;
No) echo "File was NOT deleted and remains. "
esac
这有效。
问题是,我正在尝试创建一个脚本来将垃圾箱中的项目“恢复”到它的来源位置。
这是我到目前为止所拥有的..
#!/bin/bash
cd "$HOME/my-documents/mydir01/Trash" || exit 1
mv -i "$(grep "$1" "$HOME/TrashLog")"
(TrashLog - 存储已删除文件的文件路径(以便以后可以恢复) Trash - 是我制作的回收站目录)