BASH AND BASH SCRIPTING

What is BASH

BASH Reference Manual

I have included a few useful bash scripts below

Ok to start with this is clearly NOT a script but it may be useful to get scripts working - file permissions feel free to grab source code for this table.

  USER     GROUP     OTHER  
READ WRITE EXECUTE READ WRITE EXECUTE READ WRITE EXECUTE
400 200 100 40 20 10 4 2 1

Check you are root before running a script that needs root

if [ "$(id -u)" != "0" ]; then
echo “This script must be run as root†2>&1
exit 1
fi

create iso file from cd image

cdrom / dvd disk to iso file
dd if=/dev/cdrom of=/tmp/cdimg1.iso

use mtab to find out the exact device reference to the cd device you are copying and
make sure the destination is where you want it e.g /home/user

script to download return to basic and example files

!/bin/bash
echo "script to download files for rtb"
echo "echo get binary and manual"
wget -c http://unicorn.drogon.net/rtb/rtb
wget -c http://unicorn.drogon.net/rtb/rtb.pdf
echo "get basic source files"
wget -c http://unicorn.drogon.net/rtb/ack.rtb
wget -c http://unicorn.drogon.net/rtb/animals.dat
wget -c http://unicorn.drogon.net/rtb/animals.rtb
wget -c http://unicorn.drogon.net/rtb/boxes.rtb
wget -c http://unicorn.drogon.net/rtb/circles.rtb
wget -c http://unicorn.drogon.net/rtb/colours.rtb
wget -c http://unicorn.drogon.net/rtb/cylon.rtb
wget -c http://unicorn.drogon.net/rtb/guess.rtb
wget -c http://unicorn.drogon.net/rtb/koch.rtb
wget -c http://unicorn.drogon.net/rtb/spots4.rtb
wget -c http://unicorn.drogon.net/rtb/turtle1.rtb
wget -c http://unicorn.drogon.net/rtb/turtle2.rtb
wget -c http://unicorn.drogon.net/rtb/turtle3.rtb

If running ubuntu sometimes udating etc removes ubuntu-desktop as a package the following command will reinstall and seems to fix quite a few issues sudo apt-get install ubuntu-desktop^

Copyright © 2006 Dusplic. Designed by Free CSS Templates | Valid XHTML