dumdum scripts

Results 1 to 3 of 3

Thread: dumdum scripts

  1. #1
    Join Date
    Oct 2002
    Binghamton NY

    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 !

  2. #2
    Join Date
    Jul 2002
    Vladivostok, Russia
    Are you certain it only took 15-20 minutes? The reason I ask is we haven't heard from you in awhile.
    "I was pulled over for speeding today. The officer said, "Don't you know
    the speed limit is 55 miles an hour?" And I said, "Yes, but I wasn't going
    to be out that long."

    How To Ask Questions The Smart Way

  3. #3
    Join Date
    Apr 2003
    You're right, that is pretty convoluted.

    How about
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts