My First Shell Script for Ubuntu Linux

It might not be a big thing for most people, especially developers. But for a wanna-be programmer like me, a first time is something big.

I built my first shell script for Ubuntu Linux over night – the best time I get to code. Well, though it isn’t basically much of logical codes with a flow of control, it is more echo statements than anything else. I wrote approximately 300 lines of code in a night.

It’s been more than 4-5 years since I started using GNU/Linux. I started off when my university curriculum used the gcc for programming lessons and my college obliged to using GNU/Linux. Initially, I was fascinated by something that wasn’t “Windows”. At the time, I was a big-time user of Windows and was a big fan too. But time changed me and my views. I’m an anti-Microsoft, FLOSS-loving guy now. I used to read a lot of CHIP and Digit at the time. And I used to collect all those dual-layer DVDs that the magazines distributed. Though they occassionally carried various GNU/Linux distribution images, I never bothered to even check them out. I was only bothered about the Windows software that were bundled in the DVDs and nothing else.

But slowly everything changed. It was in my second year that I realized that I’d have to get acquainted to the term “Linux”. Fortunately enough, I had at least heard of the term unlike my classmates who had never heard of Linux before in their lives (there were a few exceptions, obviously). And then everyone wanted Linux on their laptops. And I was the guy with the wide variety of Linux distributions. And that’s how my journey with Linux started. Initially, it was just installing the OS, g++ and finish. But later on, I realized how cool free software were and the best part – you get them for free. Goodbye to torrents, cracks and piracy. That’s how I was led to world of FLOSS. And I haven’t looked back since. Today, I don’t even remember if I have a Windows installation on my laptop unless someone asks me explicitly if I do.

All these years, I’ve used almost all kinds of distributions of GNU/Linux. But in the end, I stuck on to Ubuntu because of its enormous user-base, support and the level of customization options. Over the years, I’ve used a lot of

sudo apt-get install <package-name>

Especially after a fresh upgrade of the distribution. That happens every 6 months. And every time, I find myself re-installing the same software again. If only there was a way to automate the process.

I’ve realized that it is during exam times that I get the most ideas. I find myself doing everything other studying for the exam. And this time, I decided to automate my Ubuntu installation and other configurations that I usually do after a fresh upgrade of the distribution.
Earlier it was a tedious of sitting up and just watching the terminal window show me so many lines that is supposed to mean that something is being installed. Well, on another note, I’ve fallen so much in <3 with !/bin/bash. Now, I have my shell script that does just that. It installs all my necessary packages, does a few configurations (like switching off my nVidia Optimus driver which just simply burns away my motherboard, the configurations for my BSNL EV-DO Data Card, Web Server and Database configurations) and in the end I have 99% of my work done in just one command. I even set up an alias in my ~/.bashrc file so that it just takes 4-5 keystrokes to get my script runnning.

I’m waiting for the next distribution of Ubuntu to be released so that I can test the script whether it will have any run-time errors. I can’t check it right now since I already have all the packages installed. I wish I had thought of this sooner so that I could test it with the recent release of Ubuntu. But like I said, I get ideas only during my exam period.

Oh, and I’m not going to stop here. This time it was just echo statements combined with apt-get. But this is just the beginning. There are lots more to follow.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.