Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shar: handle filename with space (#565)
* shar: handle filename with space * shar from GNU sharutils can work with a filename with spaces, but this version can't * Address this by quoting the filename passed to mkdir and sed * It's not harmful to quote files which don't have a space %perl shar '0 1' > new.shar %sh new.shar x - 0 1 sed: can't read 1: No such file or directory * improve quoting of filenames containing quotes * Introduce special quoting function which determines if a filename needs quotes * Avoid hanging the shell by using the quoted name in the "echo" command as well as sed + mkdir (found during testing) * Double quotes allow double quotes to be escaped within, and many other punctuation characters don't need an escape * Some test files I inspected: %fgrep sed *.shar 1.shar:sed -e 's/^X//' >"\"" <<'FUNKY_STUFF' 2.shar:sed -e 's/^X//' >"''" <<'FUNKY_STUFF' 3.shar:sed -e 's/^X//' >"0 1" <<'FUNKY_STUFF' 4.shar:sed -e 's/^X//' >"*" <<'FUNKY_STUFF'
- Loading branch information