euglug.org

[작성자:] admin

  • [Eug-lug] More advanced procmail voodoo



    T. Joseph CARTERSat Dec 10 04:02:24 PST 2005

    If you never thought you'd see the day Joseph ASKS how to use procmail
    rather than ANSWERING, today is the day.  ;)  I have no clue how to do
    this easily..
    
    The problem:
    
    If you are an AOL user (WHY are you an AOL user!?) and you set your
    wonderful point-and-drool email client to not send out HTML mail, it still
    sends multipart/alternative email with the first attachment being:
    
    	Content-Type: text/plain; charset="US-ASCII"
    	Content-Transfer-Encoding: 7bit
    
    Now, this attachment is readable.  However, mutt chooses the latter one,
    which says:
    
    	Content-type: text/plain; charset="US-ASCII"
    	Content-Transfer-Encoding: quoted-printable
    
    No problem, all modern mail clients support that.  Except AOL lies, of
    course.  It's text/plain, and it's Q-P, but it's absolutely not us-ascii
    by any stretch of the imagination.  It's windows-1251, which means my
    messages are filled with ?????? and whatnot anywhere there's an 8-bit
    character.
    
    Now, I can trivially identify the AOL client through its msgid, or through
    its X-Mailer being a retarded string like "8.0 for Windows", but I have no
    idea how to do the two-line match to determine that one of the parts is a
    mislabelled Q-P part with windows-1252 charset.  I've managed to determine
    that AOL's software sends a proper charset for anything BUT windows-1252,
    which makes this just really annoying.
    
    So the question is, how do I match on the condition of that two-line
    breakage and, having done so, how do I fix the broken charset before
    writing the message to the destination folder?
    
    -- 
    "We are what we repeatedly do.  Excellence, therefore, is not an act,
    but a habit."
    	-- Aristotle
    
  • [Eug-lug] Advanced Bash-Scripting Guide



    T. Joseph CARTERFri Dec 9 19:36:24 PST 2005

    On Fri, Dec 09, 2005 at 03:02:12PM -0800, Bob Miller wrote:
    > This list sees a number of bash scripting questions.  I just happened
    > upon a free book that might interest those of you who want to become
    > bash wizards.
    > 
    > Advanced Bash Scripting Guide
    > http://www.tldp.org/guides.html#abs
    > 
    > Check it out.
    
    Oh, nifty!  Free books are good!  ;)
    
    -- 
    "We are what we repeatedly do.  Excellence, therefore, is not an act,
    but a habit."
    	-- Aristotle
    
  • [Eug-lug] Advanced Bash-Scripting Guide



    SteveFri Dec 9 17:37:30 PST 2005

    On Fri, 2005-12-09 at 15:02 -0800, Bob Miller wrote:
    > Advanced Bash Scripting Guide
    > http://www.tldp.org/guides.html#abs
    
    It's a must have desk reference for those who try to keep many scripting
    tools in their noodle.
    
    -- 
    Steve <euglinux at nwtechops.com>
    
    
  • [Eug-lug] Advanced Bash-Scripting Guide



    Matthew JarvisFri Dec 9 16:13:03 PST 2005

    Bob Miller wrote:
    > This list sees a number of bash scripting questions.  I just happened
    > upon a free book that might interest those of you who want to become
    > bash wizards.
    > 
    > Advanced Bash Scripting Guide
    > http://www.tldp.org/guides.html#abs
    > 
    > Check it out.
    > 
    
    
    Good stuff - thanks Bob!
    
    Now I've got my weekend reading lined up...........  <g>
    
    
    Matthew S. Jarvis
    IT Manager
    Bike Friday - "Performance that Packs."
    www.bikefriday.com
    541/687-0487 x140
    mattj at bikefriday.com
    
  • [Eug-lug] Advanced Bash-Scripting Guide



    Bob MillerFri Dec 9 15:02:12 PST 2005

    This list sees a number of bash scripting questions.  I just happened
    upon a free book that might interest those of you who want to become
    bash wizards.
    
    Advanced Bash Scripting Guide
    http://www.tldp.org/guides.html#abs
    
    Check it out.
    
    -- 
    Bob Miller                              K<bob>
                                            kbob at jogger-egg.com
    
  • [Eug-lug] O’Reilly UG Offers Ending Soon for Learning Lab, ETel, and MAKE



    Marsee HenonFri Dec 9 13:21:36 PST 2005

    Hello
     
    I wanted to alert you to three special offers that will be ending over the
    next few weeks. You can post these discounts online or on your mailing
    list. Please let me know if you have any questions or need more info. 
     
    Thanks and have a wonderful holiday season.
    
    --Marsee
    
    
    
    ***New 40% discount for ETel--Early Registration Pricing Ends January 9
    The early registration deadline for O'Reilly's Emerging Telephony
    Conference (ETel) has been extended to January 9th. Join us on January
    24-26 in San Francisco when telephony's key figures, like Jim Van
    Meggelen, Peter Cochrane, Mark Spencer, Norman Lewis, and Clay Shirkey,
    convene to provide a high-level perspective of the future of telephony.
    And as a special offer to our friends, save an additional 40% when you 
    register using code etel06lms.
    <http://conferences.oreilly.com/etel/>
    
    To register for the conference, go to:
    <http://conferences.oreillynet.com/cs/etel2006/create/ord_etel06>
    
    
    ***User Group Members receive a special 50% discount on Learning 
     Lab Courses
    As an O'Reilly User Group member, you save on all the courses in the
    following University of Illinois Certificate Series:
    -Linux/Unix System Administration 
    -Web Programming
    -Open Source Programming
    -.NET Programming
    -Client-Side
    
    This offer ends December 31st, 2005.  To redeem, use Promotion Code
    "ORALL1" to save 50%. Each course comes with a free O'Reilly book and a
    7-day money-back guarantee. Register online:
    <http://learninglab.oreilly.com/>
    
    
    ***Give the Gift of MAKE Magazine***
    Give the geek on your list a truly unique gift this holiday season--
    their very own subscription to MAKE magazine. MAKE is the first magazine
    devoted to digital projects, hardware hacks, and DIY inspiration. Each
    rich issue brings the do-it-yourself mindset to all the technology in
    your life. 
    
    Your choice:
    
    Give a gift for $5 off the regular gift subscription rate--$29.95 (US),
    $34.95 (Canada), $44.95 (all other countries):
    <https://www.pubservice.com/mk/SubGiftSplash.aspx?PC=MK&PK=U5OUGA>
    
    To place your gift order at the regular price $34.95 (US), $39.95
    (Canada), $49.95 (all other countries)--and get a MAKE T-shirt free.
    <https://www.pubservice.com/mk/SubGiftSplash.aspx?PC=MK&PK=U5OUGB>
    
    This offer ends December 31st, 2005
    
    For more information on MAKE or to read the MAKE Blog, go to:
    <http://makezine.com/>
    
    
    
    ================================================================
    O'Reilly 
    1005 Gravenstein Highway North  
    Sebastopol, CA   95472
    http://ug.oreilly.com/  http://www.oreilly.com
    ================================================================
    
  • [Eug-lug] calling all bash experts…



    Allen BrownThu Dec 8 23:01:27 PST 2005

    T. Joseph CARTER wrote:
    > Allen, $() is not part of bourne shell, just for the record.
    
    True.  I should have made that clear.  But neither is the
    ${variable##pattern} syntax.  Both are first introduced
    in korn shell (ksh) and adopted in bash.
    -- 
    Allen Brown  abrown at peak.org  http://www.peak.org/~abrown/
       Q: How do you silence an Italian?   A: Tie up his hands.
       Q: How do you silence an Engineer?  A: Take away his pencil and paper.
    
  • [Eug-lug] calling all bash experts…



    Rob HudsonThu Dec 8 17:15:00 PST 2005

    Thanks for the description.  This helped, and also I found an IBM 
    article that explains the chopping stuff too:
    http://www-128.ibm.com/developerworks/linux/library/l-bash.html
    
    Thanks all,
    Rob
    
    Allen Brown wrote:
    > Rob Hudson wrote:
    >> Looks like I can do:
    >>
    >> path = `dirname $path` # for directory
    >> path = `basename $path` # similar to path=${path##/*/}
    >>
    >> Is this the best option?
    > 
    > That is a good option.  It provides backward compatibility
    > with the boring shell (Bourne).  However I prefer the $()
    > syntax since it provides for recursion.  It is also a lot
    > more graceful about quotes.
    >   path="$(dirname "${path}")"
    > 
    > But to answer your original question
    >   directory="${path%/*}"
    > 
    > The % means to chop stuff off the end of the path envariable.
    > The pattern to chop off is /*, which means a slash followed
    > by anything.  Since we only used one %, it chops off the
    > minimum that matches the pattern.  If we had used %% instead,
    > it would chop off the maximum, resulting in the empty string.
    > Finally, by enclosing it in quotes we allow for paths with
    > blanks in them.  (Blanks are rather rude, but some people use
    > them, especially people with a Windoze background.)
    > 
    > The example you provided is fragile.  By starting with a /
    > it only extracts the basename if the path starts with a /.
    > So relative paths would fail to extract.
    > 
    > But lets use something similar
    > as a start on a different approach.  First extract the filename
    > and then use that to extract the directory.
    >   filename="${path##*/}"
    > Remove everything up to and including the first slash.
    >   directory="${path%/${filename}}"
    > Remove from path $filename and its preceding slash.  Notice
    > that since there are no wild cards in this path it doesn't
    > matter if we use % or %%.
    > 
    > One thing I don't know about these competing solutions
    > is whether the latter ones are faster than using
    
  • [Eug-lug] calling all bash experts…



    T. Joseph CARTERThu Dec 8 16:56:28 PST 2005

    Allen, $() is not part of bourne shell, just for the record.
    
    -- 
    "We are what we repeatedly do.  Excellence, therefore, is not an act,
    but a habit."
    	-- Aristotle
    
  • [Eug-lug] calling all bash experts…



    Russ JohnsonThu Dec 8 16:38:50 PST 2005

    Rob Hudson wrote:
    
    > Given a variable with something like this in it:
    > /Volumes/Projects/Testing/Simple_Carbon_App.pkg
    >
    > I need to extract the base path to get:
    > /Volumes/Projects/Testing
    
    
    basename will give you the name of the file, and dirname will give you 
    the path:
    
    $ basename /Volumes/Projects/Testing/Simple_Carbon_App.pkg
    Simple_Carbon_App.pkg
    
    $ dirname /Volumes/Projects/Testing/Simple_Carbon_App.pkg
    /Volumes/Projects/Testing
    
    Further, if you give basename an extension to strip, it does that too:
    
    $ basename /Volumes/Projects/Testing/Simple_Carbon_App.pkg .pkg
    Simple_Carbon_App
    
    Note that you must include the period, or it includes that in the results.
    
    Russ