shell-safe-rm
shell-safe-rm copied to clipboard
fixes issue #31 and #27: safe-rm prompts message when file contains whitespaces
Fixes #31 and Fixes #27
Previously using safe-rm on a filename with multiple spaces in it would succeed, but produce an error message. Now it does not produce that error message.
e.g. echo "s" > tmp\ tmp\ tmp.txt; ./rm.sh tmp\ tmp\ tmp.txt
Produced:
basename: extra operand ‘tmp.txt’
Try 'basename --help' for more information.
basename: extra operand ‘tmp.txt’
Try 'basename --help' for more information.
This occurs because the filename is passed into rm.sh as a single string with spaces, but back-slashes/quotes were not used when passing the filename into the basename
command within the script. I added the necessary quotes.