LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   dialog in the middle of a command (https://www.linuxquestions.org/questions/programming-9/dialog-in-the-middle-of-a-command-614641/)

geeyathink 01-18-2008 08:17 PM

dialog in the middle of a command
 
I am trying to learn a little more about writing bash scripts. .

I found how to use a dialog (kdialog) with a script by just invoking it or by using an if/then with the exit status of a command. But I have not found how to open a dialog that would be needed in the middle of a running command.

For instance running cp from a command line prompts me if "a file by the same name exists - overwrite?" of course the exit status is 0 no matter the choice of yes or no. (providing no other problems come up at the moment)

I have most likley looked at the answer in my searches but just did not understand.

The only thing I can think of myself (trying to use that tiny little brain again - almost never works:) )is to change the options to cp so that it exits when a file of the same name exists, use that exit status to open a dialog. Then use the exit status of that dialog to open a new instance of cp that has different options set depending on the exit status of the dialog.

Just a (strong) hint about what to look into to do what I am after would be great.

Thank you.

crabboy 01-18-2008 08:32 PM

I woluld not rely on the error from cp, but test for the condition of a file existing at the destination before attempting the copy.

geeyathink 01-18-2008 10:25 PM

Thanks crabboy, makes sense.
I guess I was thinking that because cp already knows to ask the question there would be something built in for dialog to pick up on and pass along.



easylaterT


All times are GMT -5. The time now is 06:28 PM.