Answer the question
In order to leave comments, you need to log in
How to implement a value input as part of a parameter?
Tell me how to implement the construction when there is a yes / no
condition during the script startup . And if the answer is yes - you will need to add a key and a custom value. If the answer is no - just continue the script execution. key "value"
. Where key
is a constant value, and value
- is entered by the user after running the script. Separately, I know how to do it, but it's impossible to connect.
Answer the question
In order to leave comments, you need to log in
It's not entirely clear what exactly doesn't work, but here's an example
#!/bin/bash
echo "Yes or No?"
read -p "Answer: " varanswer
echo $varanswer
if [ "$varanswer" = "Yes" ]; then
read -p "KEY: " varkey
echo $varkey
else
echo "do script"
fi
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question