FBDev64 / FBD

Funny Bone Department - Read jokes and puns.
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Store input in variable - Gum. #9

Closed FBDev64 closed 5 months ago

FBDev64 commented 5 months ago

I use a package named Gum to beautify my software (terminal app). So, it's a mini-shell where when I type "help" it outputs the list of commands. But, for that, I need to store the user input of the Gum input. See source code below.

#!/bin/sh

# Customize Console
# set-title FBD

echo "Undertale Jokes, that's all. Mainly. You know, as ya want."

while true
  do 

    #Input
    PRT=$(gum input > history.txt --placeholder " Enter Command")

    # Logic
    if PRT=="list"; then
        echo "exit"
        echo "list"
        echo "rules"
    fi
    if PRT=="exit"; then
        exit
    fi
    if PRT=="rules"; then
        echo "There is not much rules but :\n
        1. Be silly and trolly
        2. Don't insult or any things like that
        3. Always have a Sans sticker in your desktop wallpaper
        4. Chew gum while using the software
        5. Every Arch user shoulds ay "I use Arch, BTW" every day on the chat.\n"
    fi

done

For now, when I exec the software, I have the gum input, but ... See a how it actually works :

Undertale Jokes, that's all. Mainly. You know, as ya want.
exit
list
rules

I typed rules

FBDev64 commented 5 months ago

Done : new code. the problem was comparaison.