You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Concerning code blocks starting on lines 133, 96 and 156, I would recommend choosing a single-character-based reply (or, to check the exact string pattern, as shown at the end of this issue) to avoid mismatching.
You are checking case $answer in [Yy]*, which means "every string starting with 'y' or 'Y', of any length". I'd suggest using just the options (y/n), and adding a check on the string length, to be a little more certain about what the user is typing:
read -p "Do you want to disable Bluetooth services to improve security? (y/n) " answer
echo# new line (optional)if [[ $answer=~ ^[Yy]$ ]]
then# Disable Bluetooth services using systemctlfi
=~: string matching
^[Yy]$: string starts with Y or y and ends after one char
This way, ANY string different from "y" or "Y" will guarantee that the code block is skipped (so, there's no need to check the "n/N" case).
If you prefer the user to write exactly the string "yes", you can use the following pattern: ^[Yy][Ee][Ss]$
my2sats
The text was updated successfully, but these errors were encountered:
Concerning code blocks starting on lines 133, 96 and 156, I would recommend choosing a single-character-based reply (or, to check the exact string pattern, as shown at the end of this issue) to avoid mismatching.
You are checking
case $answer in [Yy]*
, which means "every string starting with 'y' or 'Y', of any length". I'd suggest using just the options (y/n), and adding a check on the string length, to be a little more certain about what the user is typing:=~
: string matching^[Yy]$
: string starts with Y or y and ends after one charThis way, ANY string different from "y" or "Y" will guarantee that the code block is skipped (so, there's no need to check the "n/N" case).
If you prefer the user to write exactly the string "yes", you can use the following pattern:
^[Yy][Ee][Ss]$
my2sats
The text was updated successfully, but these errors were encountered: