Author Topic: BASH scripting question  (Read 2060 times)

Offline Nod

  • Quando omni flunkus moritati
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 3725
  • 1337 13V3L: +210/-138
  • 212-389-1318
    • twitter: @mrnudnik
BASH scripting question
« on: October 26, 2010, 11:23:58 PM »
I need to write a simple script to automatically install certain things but I'm completely lost. It's NOTHING like writing a batch file. I know that my bash file has to start with #!/bin/bash but other than that I'm lost. One of the problems is that when I install things through the shell it always tells me that there will be n amount of memory left and asks me if I want to continue. I need it to answer y and continue the install. So if I wanted to install IRSSI with it what would come after

#!/bin/bash
sudo apt-get install irssi
I HATE the bridge.
Meme Roth is a Food Nazi Cunt

Offline TimeRider

  • Newb
  • *
  • Posts: 1
  • 1337 13V3L: +0/-0
  • Low-level employee
Re: BASH scripting question
« Reply #1 on: October 27, 2010, 01:33:29 AM »
try:

sudo apt-get -y install irssi

or

sudo aptitude -y install irssi

invoke it with 'sh ^filenameofscript'

try these at your console prompt :)
man apt-get
apt-get --help

Steve!

Offline Nod

  • Quando omni flunkus moritati
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 3725
  • 1337 13V3L: +210/-138
  • 212-389-1318
    • twitter: @mrnudnik
Re: BASH scripting question
« Reply #2 on: October 28, 2010, 12:18:10 AM »
THANKS! That seems to be working just fine. One of the programs I want to install requires having universe enabled and I'd like to automate that as well. According to this page (http://www.ubuntugeek.com/how-to-enable-the-universe-and-multiverse-repositories-in-ubuntu-804-hardy.html) the only way to do that in the command line is by editing the sources.list file. Could I automate that by having my script take a copy of a sources.list file that already has the universe/multiverse in it and copying it over the top of the existing system file? If so I'm not exactly sure on how to do that as the script and file itself will be stored on a partition on the same external USB drive I'm booting from. I'm not even sure how to get into it from the command line. Below is what I'm trying to do but is probably wrong. I'm not going to try and run it for fear of actually screwing something up even though it's a live disk.

#!/bin/bash
cp -f /whatever the usb is/sources.list /etc/apt/sources.list
sudo apt-get update
sudo apt-get -y install adobe-flashplugin
sudo apt-get -y install irssi
sudo apt-get -y install pidgin
sudo apt-get -y install wine1.2


Also, is there a way to automate tzdata to adjust the time to a certain time zone w/o having to go in and select through the menu and stuff?
« Last Edit: October 28, 2010, 12:35:51 AM by Nod »
I HATE the bridge.
Meme Roth is a Food Nazi Cunt