Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch out for Bash word splitting #5

Open
FedericoStra opened this issue Feb 8, 2022 · 1 comment
Open

Watch out for Bash word splitting #5

FedericoStra opened this issue Feb 8, 2022 · 1 comment

Comments

@FedericoStra
Copy link

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

dotfiles/.bashrc

Lines 64 to 70 in 7044573

# move to ~/.Trash instead of rm a file
function del()
{
for i in $* ; do
mv $i ~/.local/share/Trash/files/
done
}

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
Copy link
Owner

nojhan commented Feb 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants