Mounting a flash disk on non-eye-candy desktop

My non-human techno-mate (Isda as I call my computer notebook) runs slow (but stable) so oftentimes I choose not to use Gnome nor KDE as my desktop. When I’m in a rush or when I have to have more than 10 programs open at the same time, including both MySQL and PostgreSQL (yes, folks, I enjoy the best of both worlds–I use MySQL in my laptop and I use PostgreSQL to connect to our office’s database server), I choose IceWM. It’s like Blackbox with a taskbar, which I cannot live without.

The only problem with IceWM is that mounting a flash disk is tiresome. And people snooping on me admire me for being geeky but it adds to their notion that Linux is for geeks only.

Everytime I place a flash disk in a USB port, I have to fire up a console and enter the 58-character command just to mount and use it. I’ve been doing this for so long until today. I brushed up on my Bash scripting knowhow to write a simple code so that mounting a flash disk is no longer a tormentous task.

Here’s the code entitled ‘mntusb’:

#!/bin/bash

if [ “$1” = “u” ]
then
sudo umount /media/usbdisk1
else
sudo mount -t vfat -o uid=1000 /dev/”$1″ /media/usbdisk1
fi

exit 0

So when I enter the command ‘mntusb sda1’, the system mounts the flash disk for me. And when I enter ‘mntusb u’, the system unmounts the disk. Never mind the error-trapping concern of the code. Linux already does that with messages understandable enough for me.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s