Kdialog question set as string

Hi guys. I kind of have the feeling my question may be a bit outdated but I’m gonna ask it any way. I’m a little familiar with Gambas and in being aware i know i can set a string by typing in this:

Blockquote dim sresult as string
sresult = inputbox(“enter your text”)
message(sresult)
how do i do this in kdialog or even dialog

Do you mean in a bash script?

#!/bin/bash
if response=$(kdialog --inputbox "enter your text" "default")
then
    echo response was "$response"
else
    echo cancel pressed
fi

Running kdialog --help tells on how to run kdialog.

Running kdialog --help tells on how to run kdialog.

Note that the help doesn’t tell you that kdialog does simple HTML, so that info can be presented nicely. For example,

vershtml='                                                              ~
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>version checks</title>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th,td {
    padding: 10px;
}
</style>
</head>
<body>
    <table>
        <tr>
            <td>firefox</td>
            <td>ffcur</td>
            <td>ffnew</td>
        </tr>
        <tr>
            <td>thunderbird</td>
            <td>tbcur</td>
            <td>tbnew</td>
        </tr>
    </table>

</body></html>
'
kdialog --msgbox "$vershtml"