Discussion | Articles | Blogs | Books | Contact Us | Chat | Shop |
  WrongPlanet.net
User Stats

   Members: 31,112
   Online Now: 615



People Online:
Visitors: 484
Members: 131
New Today: 18
New Yesterday: 21
Latest: symanzikzimmerm

  Aspie Affection
Support Wrong Planet Awareness!
Linux bash script

 
Post new topic   Reply to topic    Wrong Planet Forums Forum Index -> Computers, Math, Science, and Technology
View previous topic :: View next topic  
Author Message
Fuzzy
Ack! Thbbbt!
Phoenix


Joined: Mar 31, 2006
Posts: 3693
Location: Alberta Canada

PostPosted: Sun Apr 19, 2009 9:23 am    Post subject: Linux bash script Reply with quote

Here is a little bash/zenity script that I wrote. You'll need to have zenity installed too. I think it comes preinstalled.

Bash is somewhat like the batch files in windows(such as autoexec.bat), but much more developed.

What my script does is allows you to select a file, which is then run through a formula called an md5 checksum. checksums are used to assess the integrity of file, especially large ones that are to be written to cd/dvd. They are most commonly seen in conjunction with operating install disk images(iso format).

My script takes this checksum and places it in an information box, so that you can compare it to the checksum provided by the download site. If they match up, you know that your file is good and you can go ahead and burn it to optical disk.

Copy this into a file called checksum.sh

Code:

#! /bin/bash
/usr/bin/zenity --info --text="      Your md5 checksum result is \n\n "$( md5sum $(/usr/bin/zenity --file-selection --title="Checksum a File" ))


I save it in a script folder in my documents. From there - at least in ubuntu - right click it and select properties, then the permissions tab. checkmark "allow executing file as program" and close.

Now you can double click it and select run, but there is a way to make things nicer.

Create a launcher.

on the desktop - again in ubuntu/debian, and maybe others - select create launcher and browse to find checksum.sh. fill in a name for the launcher - I called mine "check md5 sum" - and maybe a comment about what it does(this is for mouse overs). You can also click the little spring graphic to set an icon. close it and double click the launcher.

Now you wont get all the run in terminal/display/cancel/run buttons. You can move the launcher into the menu as well. I put mine in accessories.

Next project I will make it do the comparison for you and make it so that you can right click a file and select check md5 sum.
_________________
davidred wrote...
I installed Ubuntu once and it completely destroyed my paying relationship with Microsoft.

"careful observation of reality is a holy book unto itself" - techstepgenr8tion
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Wrong Planet Forums Forum Index -> Computers, Math, Science, and Technology All times are GMT - 5 Hours
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Wrong PlanetTM Copyright 2004-2009, Alex Plank and Yellow Sneaker Media, LLC
Alex Plank  Aspie Affection 

Terms of Service - You must read this as a user of Wrong Planet

RSS Feed Add to Google Add to My Yahoo!

Subscribe: Wrong Planet News  Wrong Planet Forums

Privacy Policy

Asperger's is not a disease

fine art