To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

http://justlinux.com/   Mon, 23-Nov-2009 09:21:59 GMT
         internet.com
  #1  
Old 10-19-2009, 08:04 PM
blackbelt_jones's Avatar
blackbelt_jones blackbelt_jones is offline
nonguru
 
Join Date: Oct 2002
Location: Binghamton NY
Posts: 2,340
dumdum scripts

"dumdum" scripts are what I call scripts that automate a process by listing commands in a text file and making it executable. Often, you can use simple editing tools like search and replace, copy and paste, etc, to repeat the same command over and over, and sometimes these simple tools can be pretty powerful.

Basically, the advantage is you don't need to know anything about shell scripting. When I finally do know how to write a script, I'm sure I'll be kicking myself for not learning it sooner, but this sort of thing works great for now, and puts real programming in the hands of just about anyone who can understand a few shell commands.

Here's something that took me about 15-20 minutes to create. It's a script for converting any or all of the *.tgz packages from Slackware 12.2 into *.lzm packages for running in Slax 6.1.2.. I'm running it right now as I type:


(Turns out I can't post the script here, it's too long for this forum. Will post elsewhere and link to it.)

How did I do it? It's pretty convoluted, but it worked. I'll list the steps, but unless you want to do the same thing, don't bother trying to follow me.

I put all the packages in one directory,
made two copies
used the bulk renaming application from xfce to change all the *tgz suffixes in one of the dirtectories to *.zzz
combined all the packages from both directories together into one directory
Copied and pasted all the urls into kwrite
used seatch and replace to change the paths for all the files into $
used an emacs macro to bring each *zzz filename up next to each *tgz name
replaced all instances ".tgz$" into ".tgz " (Note the added space)
replaced all instances of .zzz with .lzm
replaced all remaining instances of "$" with the command "tgz2lzm" followed by a space.

Made the text file executable with chmod a+x.

Somebody's probably going to show me the correct way of doing this now, and I'm definitely interested, but this script that took me fiofteen to twenty minutes is saving me hours and hours of work, and that's pretty !
Reply With Quote
  #2  
Old 10-21-2009, 06:43 PM
JohnT's Avatar
JohnT JohnT is offline
Goo-Google
 
Join Date: Jul 2002
Location: Vladivostok, Russia
Posts: 8,893
Are you certain it only took 15-20 minutes? The reason I ask is we haven't heard from you in awhile.
__________________
The young Georgia miss came to the hospital for a checkup.
"Have you been X-rayed?" asked the doctor.
"Nope," she said, "but ah've been ultraviolated."

How To Ask Questions The Smart Way
COME VISIT ME IN RUSSIA NOW!!
Reply With Quote
  #3  
Old 10-22-2009, 04:42 AM
retsaw retsaw is offline
Registered User
 
Join Date: Apr 2003
Location: UK
Posts: 1,160
You're right, that is pretty convoluted.

How about
Code:
for name in ./*.tgz ; do tgz2lzm $name $(basename "$name" .tgz).lzm ; done
This is intended to be run from same the directory as the packages to be converted and assumes tgz2lzm is in your path.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 05:21 AM.

Help File Library
Software
Command Reference
Fonts
Troubleshooting
Shells
More



internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers




internet.commerce
Be a Commerce Partner












Linux is a trademark of Linus Torvalds.

Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy

Powered by vBulletin® Version 3.7.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.