mardi 1 janvier 2019

Problem with Bash if command and variable which contains link

I have this code:

    Browsers="Firefox Vivaldi Brave Sphere Ungoogled_Chromium Tor" #Available Browsers

download_Firefox="https://www.mozilla.org/en/firefox/new/"


select selected_browser in  $Browsers; do
    echo "Chosen Browser : $selected_browser" 

    Options_for_selected_browser="Download More_Info"
        select selected_option_for_selected_browser in $Options_for_selected_browser; do
        echo "You selected : $selected_option_for_selected_browser"

if [ $selected_option_for_selected_browser=="Download" ];

    if [ $selected_browser=="Firefox" ] && [ $selected_option_for_selected_browser=="Download" ];
        then
            echo "Download here --> $download_$selected_browser" #<--First Problem is here
    fi
fi




        done
done

In case I choose Firefox, the $download_$selected_browse should be this: download_Firefox which is the link "https://www.mozilla.org/en/firefox/new/" But it just says: Download here --> Firefox. I know that a solution could be if I just put an if command for firefox and then says the link,but I prefer this method I wrote already.

The second problem is that even if I chose Download or More_Info,It says only the "Download here -->..."

Aucun commentaire:

Enregistrer un commentaire