shell script - summarise before continuing
hi all,
wrote a script that asks you multiple questions and before if actually does the commands i want it to give you a quick summary of what you have entered, if its right click continue or if its wrong exit the script and start again? many thanks, rob |
You can create a confirmation yes/no or cancel/yes graphical window box using zenity.
Another option would be to create a default yes/no question so just pressing the Enter key would automatically continue or exit depending on your preference. |
Hello and welcome to LQ. Please note the thread you started
doesn't meet the minimum threshold that would enable us to help you. We understand that Linux can be intimidating for new members, and we really do want to help. That said, please understand that LQ is not a help desk, customer service line for a product you purchased or willing to do your homework (although we are happy to assist you with specifics, if you show some effort of your own!). We're a 100% volunteer organization that wants to help you help yourself. Here are a couple tips that will enable us to help you moving forward:
allows us to help you, it's unlikely our community will be able to provide you a solution. Unfortunately, serial offenders who show wanton disregard for this request after multiple pointers may be asked to seek help elsewhere. We truly hope that isn't necessary, and assure you Linux and Open Source are extremely rewarding and well worth the learning curve in the long run. Some additional reading that may help: LQ Search LQ Sitemap LQ Site FAQ How to ask technical questions to get quality answers |
man whiptail
|
In addition to zenity and whiptail you can also create graphical boxes with dialog,xdialog or xmessage.
|
echo "is this information correct, press (y) or press (n)"
read correct case $correct in y) echo "the script will now continue";; n) echo "please re-run the script inputting correct details" exit;; *) echo "invalid selection, please re-run the script" exit;; esac |
You might want to check for upper case too.
Code:
echo "Is this information correct? (y/n)" Code:
read -r -p "Is this information correct? [y/N]" item |
While Loop
Code:
while [[ not condistion ]] ; Code:
while [[ $item != 'y' ]] ; do Code:
|
All times are GMT -5. The time now is 08:35 AM. |