PDA

View Full Version : Need help with basic Nautilus scripting



bluntu
September 10th, 2006, 08:39 AM
I would like to UNRAR a selected rar file.



unrar e $@


Problem is that some files have password so I would like a dialog to appear before doing the unrar thing. The dialog would asks for a password and then pass it onto the unrar command.



unrar e $@ p$THE_PASS


Not sure if I got that last part correct (the p[password]). I need help with the dialog and password variable.

lukew
September 10th, 2006, 02:10 PM
Collecting information from the user at the terminal is always called standard input:

< as aposed to >, which is standard output.

http://www.ibiblio.org/gferg/ldp/practical_linux_guide/x80.html

Bash does not have "dialog" though I think I have read about a program called whiptail, which can convert bash into some form of gui.

I hope this helps.

Luke

I hope this helps.

Tomosaur
September 11th, 2006, 01:05 AM
password=$( zenity --entry --text="Enter password:" --title="Password")
unrar e $@ $password

cwaldbieser
September 11th, 2006, 06:40 AM
password=$( zenity --entry --text="Enter password:" --title="Password")
unrar e $@ $password

You would probably want to add the "--hide-text" option to the zenity command so the password shows up as asterisks.