Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Im trying to make a bash script that opens up a konsoe window and executes the cmmands in the script.However when I use the command konsole -e it allows me to enter only one command. how ca I make it run commands one after the other.
The big problem is not concatenating commands, but dumping them into a newly created terminal emulator.
I usually do this (just a simple example):
Code:
urxvt -e bash -c "ls && sleep 10"
Feel free to use ||, && or ; depending on the effect you need to achieve in between the quotes. Also, in the example I use urxvt, but you can use konsole instead if you want. You will need to figure out the -e equivalent for konsole, I don't have it installed to check.
The && works in xterm but it doesnt recognize the %f and I thinks konsole recognizes it but cannot run multple commands
Try to wrap it as I did above. Instead of directly launching the stuff, use konsole -e bash -c "commands". (though my guess is that this might not work either).
Your best bet to do this kind of stuff is to wrap everything into a shell script. Then, just call your shell script instead of concatenating so much commands.
ok is there a way to run a command and show the output in a terminal
Only by running into it.
I'd try something like this:
Code:
#!/bin/bash
input_file="$1"
output_file_name="${input_file/.*/}"
ffmpeg -i "${input_file}" -acodec libmp3lame -ab 160k \
-ac 2 -ar 44100 "${output_file_name}.mp3"
read #this line wait for a return, you could use sleep
#instead or something like that
Now, you need to save that script into a directory that's in your $PATH, and chmod u+x it.
In case you are wondering, the key point when passing the argument is that kde pass arguments using %f, %u and things like those.
On the contrary, bash doesn't know about the nature of the arguments, and they are named by their position. On the kde land, we pass %f to our script, but once we are into the bash script, and since %f is the first parameter, we access this positional parameter as $1. That's the key, the rest is simple enough to understand if you made that long command line for the initial desktop file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.