"Strong Scripting Skills" - a definition? - sunday

Robert Hajime Lanning lanning at lanning.cc
Wed Jan 28 10:56:58 PST 2004


<quote who="Danny Howard">
>
> What inferior OS are you running?
>
> [...]
>      The options are as follows:
>
>      -b list
>              The list specifies byte positions.
>
>      -c list
>              The list specifies character positions.
> [...]
>
> On FreeBSD, which tends toward the vanilla, you can 'cut -c -20,40-' or
> whatever.  It is kind of overshadowed by its more powerful brethren, but
> sometimes you just want to cut by character position.  And as Unix
> commands goes, it has such an unusually straightforward name.

Gah!  Open mouth, insert foot.

Yes, you are right.  (I use Slackware Linux, Solaris, and on occasion AIX.)

I don't use cut that often, and didn't defer to the man page.

So, you would count character positions for each platform?  As the columns are
not the same everywhere.

This is why I was mentioning something about new depths of a rabbit hole. :)

You actually have to write a fairly complex script to have portable usage.
Complete with all exception handling.  Like using awk, when searching for
grep.  And using grep, when searching for awk.

One liners are usually only good for the specific situation and should be used
only when the side effects are understood.

Like Linux/*BSD users should not (as root, at least) use killall when on a
Solaris box.  You have to know to use pkill.  "killall" kills ALL processes
on the box, and is used for shutdown.  I have been guilty of this mistake,
once.  It was a while ago, but luckly it was on my own workstation, not a
production server.

-- 
END OF LINE
       -MCP




More information about the Baylisa mailing list