Two commands in one launcher

Asked by peter

Hello

I've a question and I would be glad if you can help.

I would create a launcher with the two following commands:

cd /tmp
diff a.txt b.txt

How can I do this? Thanks a lot.
Peter

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
peter
Solved:
Last query:
Last reply:
Revision history for this message
Ariel Cabral (acabral1961) said :
#1

You can make a file named 2commands.sh and fill it with the commands you want and then make a launcher that starts the .sh file.
Hope this helps, let me know.

Revision history for this message
peter (peter-neuweiler) said :
#2

Hi Ariel

Thanks for the hint. But: it doesn't work.

If I execute the launcher, I'll get an error message: There was an error creating the child process for this terminal.

I checked the commands directly by a terminal and it worked well. Do you have an idea? Thanks a lot.
Peter

Revision history for this message
Ariel Cabral (acabral1961) said :
#3

Which type of launcher do you select?

Revision history for this message
peter (peter-neuweiler) said :
#4

Application in Terminal.

Revision history for this message
Ariel Cabral (acabral1961) said :
#5

What happen if you do double click directly over the .sh file?

Revision history for this message
Ariel Cabral (acabral1961) said :
#6

You must give it execution permission to the .sh file. did you?

Revision history for this message
peter (peter-neuweiler) said :
#7

No, I didn't (if I select the sh-file to see the properties, the root has read and write permissions).

What should I do? Thanks!
Peter

Revision history for this message
peter (peter-neuweiler) said :
#8

Sorry, I didn't see this. If I double click the sh-file, the text editor will open.

Revision history for this message
Koen (koen-beek) said :
#9

you should change the permissions of the .sh file so it has execute permission

you can do this with

chmod 755 command.sh

and maybe also add the folliwng as the first line in the file
#!/bin/bash

Revision history for this message
peter (peter-neuweiler) said :
#10

Hy Koen

It's mutch better *lll. I don't get anymore an error message.

But if I execute the launcher, the terminal opens, something is written in the terminal and the terminal closes immediately.

What's the solution? Thanks.
Peter

Revision history for this message
Matt Arnold (mattarnold5) said :
#11

try putting the fallowing at the end of the file

echo Press Enter to close
read

Revision history for this message
peter (peter-neuweiler) said :
#12

Hy Matt

I don't understand. I guess:

1: echo at the end of the file
2: enter

What's about the read? Thanks.
Peter

Revision history for this message
peter (peter-neuweiler) said :
#13

Hy Matt

I guess, it works. I entered two lines:

1: echo
2: read

And now the terminal keeps open. Thanks a lot.
Peter

Revision history for this message
peter (peter-neuweiler) said :
#14

Yep, it works.

Regarding "read": what is it? A manual page (man read) for this statement does not exist.

Thanks for your answer.
Peter

Revision history for this message
Matt Arnold (mattarnold5) said :
#15

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

peter wrote:
> Question #56741 on Ubuntu changed:
> https://answers.edge.launchpad.net/ubuntu/+question/56741
>
> peter gave more information on the question:
> Yep, it works.
>
> Regarding "read": what is it? A manual page (man read) for this
> statement does not exist.
>
> Thanks for your answer.
> Peter
>

It is a built in bash command that reads user input in shell scripts.
See http://www.freeos.com/guides/lsst/ch02sec10.html for more info.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklmXGIACgkQfGeS0kace83IEwCeILYhJMVwLWUya9DD1/e/eo+0
kgQAn1ofCH8FwFT+xBWQ1P9cqoDTyjab
=JW4h
-----END PGP SIGNATURE-----

Revision history for this message
peter (peter-neuweiler) said :
#16

Hy Matt

Thanks for your answer. I'm happy, because it works.

Have a good time and be well.
Peter