Category Archives: Linux Planet

Linux Planet

Taking input from user using whiptail

In the post “Creating message box in a shell script” we saw how to install whiptail and use it to create a basic message box in scrpting.

Other than just displaying messages, scripts also take input from user. Whiptail can be used to create a small GUI for the user to enter his or her input.

To create an input box we need to use the option –inputbox, the syntax being

Example

 photo whip_input.png

By default whiptail passes the input entered to the standard error console, and in a usual shell we will be able see the entered text on the terminal after we exit from the whiptail window.

But if we want to use the entered input by storing it in some variable, we will have to go about a few manipulations as there is no direct way of doing it in whiptail.

The simple manipulation we will have to do is swap the standard error console and the standard output console which can be done by appending

to the command.

Thus we can write the whiptail command as

The varialbe val will get the value that is entered in the inputbox.

Here is an example script to see the use if inputbox

whip_input.sh

Give the script execute permission and run it to see the output

 photo whip_input_tux.png

 photo whip_hello_tux.png

Read More

Bad Voltage Season 1 Episode 22: Oval Ted Bag

From the Bad Voltage site:

We return to our normal places around the globe and continue to bring you tasty things for your ears. Stuart Langridge, Jono Bacon, myself and an inexcusable absence of Bryan Lunduke think up a new competition involving things in our houses, and also discuss:

  • Where’s our free culture revolution? Lawrence Lessig predicted a world filled with remix culture and set up the Creative Commons, but little to none of it has actually changed the way people think. Or has it? (2.25)
  • Graham Morrison of Linux Voice answers some of the questions from our discussion in the previous show about their magazine, their process, and why the December issue comes out in June (17.45)
  • Mashed Voltage: we start a new competition. Read about it on the forum and listen to it on the show, and enter before September 10th to celebrate remix culture (36.48)
  • Jono reviews the Samsung Gear Live smartwatch and the team watch, smartly (40.25)
  • Open source projects sometimes decide that they’ll build their own hardware. When they try, they fail. Why? What motivates the decision to do it in the first place? (54.22)

Listen to 1×22: Oval Ted Bag

As mentioned here, Bad Voltage is a new project I’m proud to be a part of. From the Bad Voltage site: Every two weeks Bad Voltage delivers an amusing take on technology, Open Source, politics, music, and anything else we think is interesting, as well as interviews and reviews. Do note that Bad Voltage is in no way related to LinuxQuestions.org, and unlike LQ it will be decidedly NSFW. That said, head over to the Bad Voltage website, take a listen and let us know what you think.

–jeremy

Read More

RHEL 7 / CentOS 7 : Recovering / Reset Root Password

Hello, Setting up the root password is a mandatory part of the Red Hat Enterprise Linux 7 / CentOS 7installation. If you forget or lose your password, it is possible to reset it. Now it is known as Rescue Mode / Emergency mode in CentOS / RHEL 7, Previously in RHEL / CentOS 5/6 It was “Single User […]

Read More