not that anyone cares but... here's a free decompression script i wrote
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
not that anyone cares but... here's a free decompression script i wrote
this is my first attempt at bash script. it was very hard to figure out (me being a C++ and Java programmer) and i feel like making my own interpreter now. put the script in /usr/bin and associate your .tar.gz .tar and .gz files with it. then all you have to do is click on them once and they will automatically extract to a folder. i'm sure you'll be able to figure out how to add more extentions.
thanks to all the people who helped me figure this thing out!
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Required parameter not provided."
else
#get the lowercase string for string comparing
fFile=`echo $1 | tr [:upper:] [:lower:]`
if [ ${#fFile} -gt 7 ] && [ `expr substr $fFile $(( ${#fFile}-6 )) 7` = ".tar.gz" ]
then
#echo "found .tar.gz"
gunzip -d $fFile
tar -xf `expr substr $fFile 1 $(( ${#fFile}-3 ))`
elif [ `expr substr $fFile $(( ${#fFile}-2 )) 3` = ".gz" ]
then
gunzip -d $fFile
elif [ `expr substr $fFile $(( ${#fFile}-3 )) 4` = ".tar" ]
then
tar -xf $fFile
else
echo "The parameter provided does not end with .tar.gz .tar or .gz"
fi
fi
---newbie note: put this into a text editor and save it... then do a chmod 755 /usr/bin/decompress so that the system *allows you to use it*
would be 2 different things... but yeah, a switch statement would be much better than an else if ladder... but everything that's bash that i touch turns to "bad something-or-other" ... so i'm not going to screw with it anymore tonight!!
Originally posted by trickykid Put formatted text with spaces and such inbetween the [code] tags when wanting to keep the format of your scripts, etc in the forums...
what do you mean by formatted text? how do i do that?
Originally posted by versaulis what do you mean by formatted text? how do i do that?
Ummm.. when your making your posts, by default the forums will not read any extra spaces or tabs in your text, if you place them inbetween the code tags by doing something like this:
I put 5 spaces inbetween each word on the following line:
Hey look at this
It will look like this in the forums if you use the [ code ] tags:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.