rreeves
rreeves

Reputation: 2458

Linux Dialog Input Box Problems

I'm having a issue with the input-box on dialog. It is overlaying the text that was typed when enter is pressed. This happens wherever the cursor focus is when enter is pressed.

This is the code im using it is bash

OUTPUT="INPUT.txt"
>$OUTPUT

dialog --stdout --title "Client Name" \
--backtitle "Setup" \
--inputbox "Enter The Client Name" 0 0 2>$OUTPUT
CLIENTNAME=$(<$OUTPUT)
rm $OUTPUT

enter image description here

Upvotes: 0

Views: 2246

Answers (2)

Raven
Raven

Reputation: 246

Found this entry while web searching, just wanted to add that there's no need for temporary files and redirection when using dialog, you can store the textbox input into a variable directly with the option --output-fd 1:

#!/bin/bash

Client_Name="$(

   dialog                                             \
      --output-fd "1"                                 \
      --title     "Client Name"                       \
      --backtitle "Setup"                             \
      --inputbox  "Enter The Client Name" "0" "0"

)"

echo "Hello, $Client_Name."

Upvotes: 0

emi
emi

Reputation: 757

You're using the --stdout option, but redirecting STDERR instead of STDOUT.

Change

--inputbox "Enter The Client Name" 0 0 2>$OUTPUT

To

--inputbox "Enter The Client Name" 0 0 >$OUTPUT

That will fix it when using --stdout.

Upvotes: 2

Related Questions