A way to open a window for user input in shell script?
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.
A way to open a window for user input in shell script?
Is there a way to have a script open a window for user input? The only way I can do this now is like: ... from an example from my script:
/usr/bin/rxvt -name rippa -pixmap ~/pics/ripparxvt1.xpm -e vim ~/download/.rippage ; ~/.LOCAL_APPS/stream2mp3.sh `cat ~/download/.rippage`
In the file .rippage I put 2 separate strings of text on one line, then the stream2mp3.sh uses them as $1 and $2 through using the output of cat on .rippage. those ` characters are great, and this method is a good hands off approach to modifying specific args in a script you often run from a fluxbox menu without needing to run it from the shell.
This works alright, and I have flexibility, like being able to use xedit, vim with a rxvt custom background (not gvim, b/c the next queued command runs while gvim runs) and perhaps other editors. Is there not a better way, though? Maybe an operation built into bash? I made this way up, AFAIK, but am I reinventing the wheel?
Thanks for the help, Community!
--Tangent:$
For those interested in a cool way to use your fluxbox menus with other computers on the network, this is one tweak of your menu file:
This is how I'm converting playlist type streams to mp3s. I paste the stream url first and type the mp3 name I chose second into vim. I don't automate the removal of the initial file and the wav file for my own reasons, but in the future I might, but I'll wrap it in 'find' to make sure it only deletes wavs from the last hour or so.
Why use ssh to rip these streams on a separate computer? I thought my computer was fast, but when I use mplayer to rip streams like how I demonstrate above, this computer becomes unstable. I can barely switch desktops, open apps, type, etc. I can do it on the headless machine without disrupting my work flow.
But, yes, fluxbox menus are great -- they can make life so much easier. Ever have a program you have to kill every now and then? For me, those programs are mplayer and firefox:
I kill mplayer twice, because firefox uses 2 mplayer processes.
Maybe next time I'll post snippets of my submenu/customenu that uses find to create playlists based on either video age, access time or file size, and uses mplayer to play them all in full screen. Of course, since it's a fluxbox menu, I created a thousand variations of ways to feed these playlists to mplayer (randomly, with different edl files for party-mode effects, no sound, different video drivers/audio drivers, edl recording mode to make new edls for a movie or party; animated gif mode, where playing the video uses a specific edl file and makes an animated gif). Some of these options use the rxvt window popup input for experimentation on bluray encodes, or whatever other lesser used arguments I have not yet made clickable.
It's all just bash, but within the reach of a mouse click.
Last edited by Anithen; 07-10-2008 at 11:22 PM.
Reason: punctuation
H_TeXMeX_H: Thanks for letting me know about xdialog. It's exactly what I had in mind. I did not expect there to be so many options. I hate to admit this, but it seems confusing. It can be very handy, though -- especially being able to have the directory and file selection. Now I won't have to use Emelfm for all file operations.
Mr. C.: Thanks for your suggestion, too. It looks like zenity is gnome based, so I'm not going to be able to install that just yet, but thank you for your words. As with Texmex, your suggestion showed me that applications like this do, indeed, exist.
It's a common misconception that you can't mix KDE and GNOME apps. Note that Zenity is not "Gnome-based"--it is GTK-based. All you have to do is install the right libraries
As you're a Slacker, check out how the netconfig utility works (it's the script that during install prompts for network parameters). It uses a command dialog (see man dialog for more info).
Not sure if it's the same as the earlier mentioned xdialog or something totally different.
Hey, guys, Thanks for the clarification. The zenity website mentioned gnome, so I just back peddled away from it. Xdialog is installed now, and I'm reserching how to use it with my scripts.
And thanks for mentioning dialog, my friend from South Africa. I was looking into that after reading about xdialog. I think X based menus will be nicer for this instance. I'll probably experiment with both (like whether dialog allows for showing the pixmap background of rxvt).
Thanks, All. I knew there had to be a more official alternative to what I'm doing.
Last edited by Anithen; 07-12-2008 at 10:54 PM.
Reason: spelling
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.