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
Is your feature request related to a problem? Please describe.
These two scripts have no confirmation and it is like having rm -rf /* over the user's fingertips.
Describe the solution you'd like
Add an overridable prompt which will prevent most human errors and allow headless operation to run smoothly by passing an environment variable.
#!/bin/bash# Check if NO_CONFIRMATION environment variable is setif [ -z"$NO_CONFIRMATION" ];then# Prompt user for confirmationread -p "Are you sure you want to perform this operation? [y/N] " confirm
if [[ !"$confirm"=~ ^[Yy]$ ]];thenecho"Operation cancelled."exit 1
fifi# Perform operation hereecho"Performing operation..."
Describe alternatives you've considered
Commandline argument -y will do the same as the environment variable, and more convenient.
#!/bin/bash# Check if either -y option or NO_CONFIRMATION environment variable is setif [[ $1=="-y"||!-z"$NO_CONFIRMATION" ]];then# Skip confirmationecho"Skipping confirmation."else# Prompt user for confirmationread -p "Are you sure you want to perform this operation? [y/N] " confirm
if [[ !"$confirm"=~ ^[Yy]$ ]];thenecho"Operation cancelled."exit 1
fifi# Perform operation hereecho"Performing operation..."
Additional context
Help message can be added:
#!/bin/bash# Function to display help messagedisplay_help() {
echo"Usage: <script_name>.sh [OPTIONS]"echo"Options:"echo" -y Skip confirmation"echo" -h Display this help message"echo"Environment Variable:"echo" NO_CONFIRMATION Set this variable to skip confirmation"exit 0
}
# Check if -h flag is presentif [[ $1=="-h" ]];then
display_help
fi
The scripts within install.sh are using /bin/sh instead of /bin/bash so some rewrites are necessary if the example code does not work as intended.
The text was updated successfully, but these errors were encountered:
This repository uses a bot to automatically label issues which have not had any activity (commit/comment/label) for 45 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the bot can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the bot will automatically close the issue in 14 days. Thank you for your contributions.
Is your feature request related to a problem? Please describe.
These two scripts have no confirmation and it is like having
rm -rf /*
over the user's fingertips.Describe the solution you'd like
Add an overridable prompt which will prevent most human errors and allow headless operation to run smoothly by passing an environment variable.
Describe alternatives you've considered
Commandline argument
-y
will do the same as the environment variable, and more convenient.Additional context
Help message can be added:
The scripts within
install.sh
are using/bin/sh
instead of/bin/bash
so some rewrites are necessary if the example code does not work as intended.The text was updated successfully, but these errors were encountered: