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

Fix dmenu soft lock; shellcheck; minor enhancements #34

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Role92
Copy link

@Role92 Role92 commented Jan 2, 2022

No description provided.

Copy link

@choudhary-akash choudhary-akash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the quotes around the query variable before echoing it to sed.

query=$(dmenu -p "Search Torrent: " <&-)
else
query=$1
fi

query="$(echo $query | sed 's/ /+/g')"
query="$(echo "$query" | sed 's/ /+/g')"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is best not to put quotes around this query variable. Without quotes, if the user entered something like " Suicide Squad " with a bunch of leading and trailing whitespaces, echoing it would automatically remove the leading and trailing spaces and only the space between the words would get replaced by plus sign in the following sed command. So, the output query would be "Suicide+Squad".

Whereas, if you put quotes around the query variable while echoing, it wouldn't remove the extra spaces and all those extra spaces would get converted to plus signs in the following sed command. In this case the output query would be something like "++++++Suicide+Squad++++"

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

Successfully merging this pull request may close these issues.

2 participants