Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My bash-script is not run in a terminal, but opens a terminal at runtime to ask for user input (sudo password). I would like to tell the user in this terminal what the script is trying to do. First, here is my script:

#This should install: Qt Linguist, lrelease

#for Qt Linguist
dpkg-query -l qt4-dev-tools
if echo $? == 0; then

#for lrelease
dpkg-query -l qt4-default
if echo $? == 0; then

echo $check1
echo $check2

if [ $check1 = 1 ] && [ $check2 = 1 ];then
 gnome-terminal -x sudo apt-get install qt4-dev-tools qt4-default

This opens a terminal with this:

[sudo] password for "username": 

But I would like to have:

qt4-dev-tools and qt4-default are missing. Now trying to install.
[sudo] password for "username": 

How do I get this when starting the terminal with gnome-terminal -x?

share|improve this question
up vote 4 down vote accepted

I've had trouble passing multiple commands to gnome-terminal before, too. Something like this is what I eventually ended up using in my case:

gnome-terminal -x bash -c "echo \"qt4-dev-tools and qt4-default are missing. Now trying to install.\" && sudo apt-get install qt4-dev-tools qt4-default"

Hope it works for you.

share|improve this answer
Perfect, many thanks! – user2366975 Sep 28 '13 at 11:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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