whiptail - If statement goes else every time - bash -
i new here, apologize mistakes, , sorry lack of knowledge (i'm beginner). here is, doing little script in bash li , have if statement, here
#!/bin/bash something=$(whiptail --inputbox "enter text" 10 30 3>&1 1>&2 2>&3) if [ $something ?? 'you' ]; echo "$something" else echo "nope" fi to specific want - enter word/sentence/whatever whiptail, , if contains of of string prints it, every times goes else ;_;.please help.
edit works, need check if string contains word.
if [[ $string =~ .*my.* ]] doesn't seem work
i don't @ all, losing hope , searching web i've encontered on
#!/bin/bash option=$(whiptail –title “menu dialog” –menu “choose option” 15 60 4 \ “1” “grilled ham” \ “2” “swiss cheese” \ “3” “charcoal cooked chicken thighs” \ “4” “baked potatos” 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; echo “your chosen option:” $option else echo “you chose cancel.” fi and i've pasted script check how works , modify it, isn't mine script , supposed work, says “you chose cancel.”
Comments
Post a Comment