Bash, For loop, Files with spaces

Posted by Michael Giarlo on September 27, 2008

Dear Future Me,

Are you trying to iterate over filenames with spaces in them using a bash 'for' loop?  And instead of iterating over the filenames, you wind up seeing a list of filename parts split by said spaces?  Use case: you want to print out a list of unique extensions for all files in the current directory and below:

    for file in `find . -type f`; do echo ${file##*.}; done | sort | uniq

If any filenames have spaces in them, you may see odd results.  The answer?  Set the input field separator (IFS) environment variable to the newline character (rather than the default space character):

    export IFS=$'\n'

And voila.

The so-called "bailout bill"

Posted by Michael Giarlo on September 25, 2008

Dear elected representatives,

I write you as a voting constituent outraged by the possibility of Congress passing the so-called "bailout bill" put forward by Messrs. Bush, Bernanke, and Paulson.  I implore you, as my representative, to weigh carefully the options before you.

A vote to pass this bill is a vote of confidence in the George W. Bush administration and future administrations, whomever they may be.

It is a vote that abdicates Congress's constitutional duty to oversee the acts of the executive branch and provide checks against imbalances and abuses of power.

One cannot honestly decry the actions of the Bush administration, as Democrats have for nearly eight years, and then hand them the keys to the economy — not to mention $700B of hard-earned taxpayer money — merely because it is politically expedient.  There are greater ills than inaction.

Passages such as the following are reason enough to reject this plan outright.

Decisions by the Secretary pursuant to the authority of this Act are non-reviewable and committed to agency discretion, and may not be reviewed by any court of law or any administrative agency.

This is a constitutional travesty.

The plan itself is a shot in the dark; Messrs. Paulson and Bernanke themselves testified that it may or may not work, and that the $700B amount is just an estimate.  They may in fact need to appropriate yet more taxpayer money to bail out corrupt and incompetent investors.  With language like the above, Congress may be powerless to stop them, and by their own hand no less.  Most worrying is that when Congress lacks the power, so does the citizenry.

If Congress passes this bill and grants the executive branch the powers described within, the American people will have no legal recourse to stop the Department of the Treasury and the Federal Reserve from squandering their wealth.

I urge you, sirs and madams, to vote against any plan that would strip Congress of its oversight responsibility.  For this is your constitutional duty and is a key mechanism by which our republic functions.  When this duty is removed from the legislative branch, members of whom are elected directly by the people and serve at our pleasure, the government ceases to function as it was intended.

I cannot in good conscience support any member of Congress who would break his oath to support and defend the Constitution, and I, like most Americans, do vote my conscience.

P.S. Sorry for all the bold.

DRM for Librarians

Posted by Michael Giarlo on September 08, 2008

I know precious little about rights management.  And what I do know I have gleaned from the occasional Slashdot post or Wired article.  Former colleague Grace Agnew, Associate University Librarian for Digital Library Systems at Rutgers University, has put the wraps on a book about digital rights management targeted at librarians, Digital Rights Management: A Librarian's Guide to Technology and Practice (also available in paperback):

This book provides an overview of the current landscape in digital rights management (DRM), including: an overview of terminology and issues facing libraries, plus an overview of the technology (including standards and off-the-shelf products). It discusses the role and implications of DRM for existing library services, such as integrated library management systems, electronic reserves, commercial database licenses, digital asset management systems and digital library repositories. It also discusses the impact that DRM ‘trusted system’ technologies, already in use in complementary areas, such as course management systems and web-based digital media distribution, may have on libraries. It also discusses strategies for implementing DRM in libraries and archives for safeguarding intellectual property in the web environment.

If you're a librarian or information professional looking for an introduction to DRM, an underpinning for rights management strategy, or a refresher on rights management technologies, you might consider checking it out.

For full disclosure, I was one of several reviewers of this book.