View Full Version : shell script: run aptitude interactively

March 24th, 2009, 11:23 AM
I'm setting up a script to use aptitude to install xorg, Slim, and midori

Now the problem is, I need the user to interact with aptitude. Is this possible?:

sudo aptitude install xorg slim icewm menu midori

March 24th, 2009, 11:41 AM
how about the read command?

March 24th, 2009, 02:22 PM
can you give an example with the script?

March 24th, 2009, 03:37 PM
I think they'd have to type the data in before you run the app, is that okay?

March 24th, 2009, 04:04 PM
they run it from the command line.

March 24th, 2009, 04:47 PM
they run it like: (i think)

(bash) user@example:~$ ./myscript.sh

March 24th, 2009, 06:14 PM
You could probably implement that idea just fine. You might just add a note to the user to "right click on the script file after downloading, click on the Permissions tab across the top, and then put a check next to 'Allow executing file as a program.'" After that, you could advise to "click Run in Terminal after double-clicking it." It should ask for the user's password then all should be good. Pretty simple. Friends or customers typically like more clicking and less typing for some reason unless it's e-mail or whatever.

March 24th, 2009, 06:14 PM
If you want to program a script that does intelligent choices, you want to look at "expect".
You can probably make a one-liner with "apt-get" instead of aptitude as well, that installs it with the default options.

March 24th, 2009, 09:26 PM
No, the script is intended to run on the command-line version of ubuntu.

And I tell the user to chmod first.

Now, a side question: would installing xorg with -qq in apt-get have anything like debconf to run? (like configuration)

March 24th, 2009, 09:28 PM
oh, and I tell the user to run su first.

March 25th, 2009, 09:04 PM

March 25th, 2009, 09:07 PM
What are you trying to write a script to do this for? Also, what kind of user interactions are you needing?

March 25th, 2009, 09:54 PM
I really don't get this... If you want an "interactive" (whatever you mean by that) aptitude:


And voilą, you get a very nice TUI.

If you want to use command lines, aptitude already does that...

March 26th, 2009, 11:00 AM
I make the user run a script in bash to install some programs - but will the script be interactive in case debconf appears and other stuff?

See the first post for the script.

March 26th, 2009, 11:21 PM