in reply to Re^3: backticks and quotation trouble in bash
in thread backticks and quotation trouble in bash

Unfortunately, it's more a restriction that "all my programs be in bash" for maintainability by other admins who potentially don't know perl. Using perl like I am here is a bit of a stretch, but it seems silly to use 6 pipes with alternating awk and sed lines when this is more readable and flexible, especially because the whole line can be commented as "get the hostname using DNS". Alas.
  • Comment on Re^4: backticks and quotation trouble in bash

Replies are listed 'Best First'.
Re^5: backticks and quotation trouble in bash
by CountZero (Bishop) on Dec 18, 2012 at 23:04 UTC
    So how will the other admins maintain the Perl part of your bash-script? It will not be more readable for someone who does not know Perl and they might indeed prefer 6 pipes, awk and sed.

    Wouldn't it be better to write a little Perl-script with well defined in-and-output and use that as a "black box" kind of building block?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics