3

I'm having difficulty converting some zenity based script to use whiptail instead.

The working script looks something like this:

#!/bin/bash
xfreerdp /v:farm.company.com \
/d:company.com \
/u:$(zenity \
--entry \
--title="Username" \
--text="Enter your Username")

I am trying to convert this to use whiptail instead, but keep getting a blank screen.

This is what I have so far:

#!/bin/bash
xfreerdp /v:farm.company.com \
/d:company.com \
/u:$(whiptail \
--inputbox "Username" 10 30)

What am I doing wrong?

3

The reason the that you do not see the input box is because whiptail writes the display to stdout, which you are capturing. The result of the input is written to stderr, which you are not capturing. To make this work, you need the command substitution to capture stderr, but not stdout. You can do this with redirection:

#!/bin/bash
xfreerdp /v:farm.company.com \
/d:company.com \
/u:$(whiptail \
--inputbox "Username" 10 30 3>&1 1>&2 2>&3)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.