Tutorial: A Simple bash Script

From Free Geek Toronto
Jump to: navigation, search

by Eugene Ruthven 20110518

What is bash?

bash is an environment that allows you to run commands on your computer.

What kind of commands?

Simple explanation - basically - anything that can affect your computer.

So - why did I write this example?

Lately, I've run into fgt computers where the line that shows what apps are open is not in view and apparently there is not an easy, quick way to display it again. Of course, if someone out there knows how to make it visible quickly and easily - please let me know.

This example is about how to create a bash script that will reset the panels to the default when Ubuntu is first installed. It means that any customizations would be lost. This example shows the basics of creating a bash script. There are many other commands (hundreds?) that can be used.

1. Login.

2. Go into Applications --> Accessories --> gedit Text Editor.

3. Type the following 4 lines in a new document:


gconftool --recursive-unset /apps/panel

rm -rf ~/.gconf/apps/panel

pkill gnome-panel

4. Click File --> Save and save the file as resetpanels.sh.

5. Go into Applications --> Accessories --> Terminal.

6. Type ls -ls and hit Enter to get a file listing and make sure you see resetpanels.sh.

7. Type chmod +x resetpanels.sh and hit Enter.

8. Go Places --> Home Folder.

9. Find resetpanels.sh.

10. Right-click on it and get a popup menu.

11. Click Open.

12. Get another popup window - click Run.

13. Wait for panels to be reset to the default look of Ubuntu when it has been first installed.

14. Done.