Watch out for Bash word splitting
Opened this issue · 1 comments
FedericoStra commented
Hey, I was browsing your really interesting dotfiles and noticed that there are several instances of incorrect word splitting in the .bashrc
file. For instance
Lines 64 to 70 in 7044573
should be written as
# move to ~/.Trash instead of rm a file
function del()
{
for i in "$@" ; do
mv "$i" ~/.local/share/Trash/files/
done
}
in order to handle paths containing whitespaces. There are a lot of other potentially dangerous similar occurrences.
I recommend you check .bashrc
and other related files with ShellCheck: it's really good at spotting this bugs.
nojhan commented
Thanks, you're definitely right, I should have updated that years ago :)
…On Tue, Feb 8, 2022 at 11:19 AM Federico Stra ***@***.***> wrote:
Hey, I was browsing your really interesting dotfiles and noticed that
there are several instances of incorrect word splitting in the .bashrc
file. For instance
https://github.com/nojhan/dotfiles/blob/7044573f7e82c8cec9171f4a3f463bb80197c94a/.bashrc#L64-L70
should be written as
# move to ~/.Trash instead of rm a filefunction del()
{
for i in "$@" ; do
mv "$i" ~/.local/share/Trash/files/
done
}
in order to handle paths containing whitespaces. There are a lot of other
potentially dangerous similar occurrences.
I recommend you check .bashrc and other related files with ShellCheck
<https://www.shellcheck.net/>: it's really good at spotting this bugs.
—
Reply to this email directly, view it on GitHub
<#5>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFSUOCKK7RDSLBWF2CKRDU2DUZLANCNFSM5NZ77SHQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>