Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
copied='cp -v *SNAPSHOT.jar /home/user/folder'
$copied

prints information about copied files

however

gdialog --title "done" --clear --yesno "done $copied" 15 60

shows command that was executed, so it shows

done cp -v *SNAPSHOT.jar /home/user/folder

How to make gdialog show information about copied files ?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

When you write

copied='cp -v *SNAPSHOT.jar /home/user/folder'

this is only a variable assignment, the command is executed when you write

$copied

that is equivalent to

cp -v *SNAPSHOT.jar /home/user/folder

If you want to capture the output of the command you should do

output=$(cp -v *SNAPSHOT.jar /home/user/folder)

this execute the cp command and put the stdout of the command in the variable output. Then you can use this variable to show the message in gdialog:

gdialog --title "done" --clear --yesno "done $output" 15 60
share|improve this answer
    
this also can be done by using ` instead of ' –  UAdapter Oct 19 '11 at 7:34

Your Answer

 
discard

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.