- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I can understand piping data from one Unix command to the next - that's what you do in shell scripting. Using a separate script, and interim scratch file as the pipe between them sounds like someone not knowing how to use the tools available. If you hold your thumb on top of the nail before bringing down the hammer, don't blame the hammer....
For example, previous suggestions that this could be written in just a few lines of shell script are entirely correct (isql to retrieve the data, piped to awk to do additional formatting/filtering/etc., piped to tee to save a copy of the output in a file, piped to ftp to send the data file someplace).
Bad code can be written with any tool, just as good code can be written with any tool.
IMHO, beyond the rookie's poor use of unix tools, the WTF here is: where was the person who should have reviewed the system before deployment? (surely, nobody with half a brain would deploy a funds-transfer system without at least having it reviewed for correctness, points of failure, and general WTF-ishness, no?)
Admin
The REAL WTF is people saying "The REAL WTF is people saying "the REAL WTF is people saying "the REAL WTF is people saying "the REAL WTF is people saying "the REAL WTF is people saying...
Admin
The real WTF is getting beaten in saying the REAL WTF is people saying ...
Admin
You're new here, aren't you?
Admin
This is no unix philosphy -- it's lame "haha I know unix, watch me" philosphy. I am a Unix admin, and this is shitty.
Just because it can be done, doesn't mean it's right... to me Unix is usually all about lean, mean, short and efficient tasks. Stuff that runs quick to do something, precisely.I can do just about anything I need to do in bash, sed, awk (and even they can be replaced with "tr" and "cut" for most uses).
Actually there's something with people learning Unix that think they have to use every single feature of the shell no matter what they're doing. I think it has to do with the documentation being written in order to show off as much as possible. The amount of people who do
cat somefile | grep expression
is astoundishing. I call this pipe abuse disease. (PROTIP: you can do "grep expression file")
The amount of people who also use * to tar up folders and then complain it doesn't contain hidden files afterwards.
Or those who can't understand the difference between "killall" on Linux and "killall" on Solaris. The day someone tried to kill httpd that way found out that the name did exactly as it implied.
Of course I abuse the shell myself sometimes. I am quite quick to do a "for i in * ; do..." on the command line because it's the first thing that comes to my mind... one day, I was too lazy to kill all the 9 squid pids (some were named squidGuard, so killall squid would not work) so I did this:
I'd say the thing above is even against the Unix philosophy :P
But I do understand the OP was making fun of those "who-feel-it-has-to-be-this-way". Unix is simple once you understand it.
Admin
The fake WTF is posting complaints about other posts being annoying.
That's annoying^2.
If you ignore them, they will go away ... mostly. Except the first posts, because people get too excited when they see '0 replies'.
About the need to break things into scripts rather than run one long query .... If you can break the process up into seperate script functions, you could do the same with your stored procedure queries ... using BEGIN, END , COMMIT, ROLLBACK etc. That would give all of the same functionality of breaking points and step by step analysis of the process, but be way more manageable.
I will say I love the GREP command. Can't they add it to Ansi 92 9well the next version) SQL?
Admin
Sounds like classical lycos germany coding style.
The whole site is made that way... and even worse!
By the way: The spaces come from continually saving in windows format on a unix box and re-reading it as unix text due to bad editor settings. Those guys never even heard of LOC or the advantage of clean indenting! ;)
Admin
Once they make a Visual Studio Unix Shell Script (where the awk and sed has intellisense) it might catch on a bit more.
My favorite thing about UNIX was only rebooting my server every 2 or 3 years.
Admin
So, again, what you are saying is that it has nothing to do with UNIX and its philosophy, but with braindead programmers implementing bad design.
-dZ.
Admin
Have you ever played with MKS' unix utilities for DOS? They have a GUI front end for grep.. so you gotta navigate to the folder, double click to launch the gui, then check off "-i" (case insensitive), navigate to the folder to be grep'd, etc. Gaaaaaaaa!
Admin
Oh good - I can now feel all superior because it never occurred to me to do that.
Mind you, I don't think it would have immediately occurred to me to use SQL as a text-formatting utility either...
Admin
WTF? The O'Reilly SED/AWK book is one of the worst things they've ever produced. Just better than the Head First... series, in fact.
Admin
I saw that MKS POS once - company was to paranoid to use the free stuff cuz there was nobody to sue if it didn't work.
Admin
You can do that?
I thought all EULAs has paragraphs about not acknowledge any responsibility.
Admin
<font size="3">This smells like a one off process that got institutionalized.
Happens all the time.
The real WTF (if there is one here) is how long it took to decide to design and write it right.
This stuff has been around since forever. Folks put tape on the drum cards. Folks hit the UPSI switches on the console of 360s. Then IBM actually EMULATED those suckers in software so you could manually intervene in the program through a program!!
I figured it out: as the quality of the forum software goes up, the quality of the posts goes down.
</font>
Admin
Stack overflow
Admin
Hey, it could have been worse... they could have used Perl! :-)
(I kid! I have the Camel book sitting right next to me and I love regular expressions. Speaking of which, I bet all that text manipulation could've been done in a single regex, and I could've even put comments in it with the /x modifier!)
Admin
Admin
Yeah, this is certainly against the Unix philosophy of "Keep It Simple, Stupid". Scripts are great for many things, and piping output from one program to another is a great feature of Unix, but when the task is as large and as important as this, I would not leave it to something like this nightmare. Shell scripts ought to be used to help chain together a series of programs together.
Obviously, whoever designed this didn't fully understand Unix (and thus, Unix philosophy) if the script was being kept in a directory in /usr and required being the root user to get. Were those non-techies were logging in as root through the GUI? (shudders)
Admin
?admin=true
:)
Admin
>> I just can't fathom how someone can understand awk, sed, and stuff, and not understand basic
>> programming concepts. Someone please shoot the developer and put him out of our misery.
Well aren't you presumptuous. Don't you think someone who understood awk, sed, etc. would have gotten it done in 1 day? The developer probably spent "weeks" googling, and posting strange questions to message boards.
Admin
So? You want the command-line version, use the command-line version - it's not like they don't provide one. Or you could split the difference by adding the folder with the GUI front ends to your PATH.
Admin
Actually, I only use the command line version, and yes, it most certainly is on my path (I've been writing complex shell scripts for decades); I just thought the GUI version was hysterical ;)
Admin
Job security...
Admin
The poor design of the described system has nothing to do with UNIX (or any of its variants). It has to do with the abuse of tools with which one is familiar and a lack of familiarity with more appropriate tools (all-I-have-is-a-hammer-and-I'm-not-even-that-good-with-it syndrome).
Java/Perl/Windows/whatever zealots (or neophites) think Java/Perl/Windows/whatever is the best solution for everything.* The truth of the matter is that the person who created this particular array of unnecessarily-complicated scripts to perform a relatively simple task was probably a summer intern or somebody who just plain didn't know any better.
A script is likely to be a worthy solution here as the author noted.
If you prefer to misappropriate responsibility to some "Unix pros [who] just can't let go of Unix, and have to wedge shit like scripts into everything", then you are no better than the mythical scape goat you have concocted to be the recipient of your disparagement. However, if you are instead referring to those who consistently hack together a half-baked just-get-it-to-work solution, then I am sad to inform you that those individuals do not solely exist as UNIX users/developers. They are everywhere on every system using every technology in every market sector in every company.
No, it is not. It is very inadequately-designed and not maintainable. It is no more "Unixy" than poorly-implemented UIs are "Windozy" or inconsistently-named functions are "PHP-like".
UNIX was designed to be powerful and simple where small (often discrete) tools could be used in concert to create processes that were more productive than the sum of the abilities of their parts (a look at the man pages of find, tar and nc bring many to mind).
UNIX was the epitome of implementation reuse well before any of modern computing buzzwords were even coined. That does not mean that UNIX (like any other technology) can't be abused. It can, just like SQL, Java, XML, threading, TCP/IP, the Internet, C#, grid computing, [insert your favorite technology that you think is above the fray here]. If you think that a handful of inefficient and unmaintainable shell scripts is bad, you're right. If you think it reflects poorly on UNIX, fine, but I ask you, what then do you say about integrating a web browser with the OS kernel?
Admin
Admin
OMG!!111!!eleven!11!!! '0 replies'!!1!11!!!11 Eh, WTF, ehm, fffff.... FFFF.... FFFFF!!!!! FFFFist!11!!1!!!
/me pants heavily.
Admin
IMHO a company which provides online money transactions should have a "better" system than a bunch of shell scripts. But than again i may not have grasped this whole UNIX-philosophy thing.
Admin
Surely not. Perl excels at database manipulation, and this would have been made with 20 lines of good perl, and would be rock-solid. This was made in shell by someone who don't even know proper shell programming.
Admin
Whoa...
Just whoa... Shame you haven't posted some of these code nuggets in the first place, even the most AWK/SED-intoxicated monkey wouldn't have dared defending the WTF.
Infinite loop at best, no optimization (and therefore stack overflow) at worst, the compiler still needs to infer a termination condition to optimize the tail-recursion.
Don't you think someone who understood awk, sed, etc... would have realized early on that they were not tools fit for the task at hand?
Why of course, just as good code can be written with ASM, or in binary...
Admin
Well well... RJ bumped into something similar I had to try to maintain for a while. "My" system created a bit over 250 temp files (every time new ones) of sql, temp strings, temp results, substrings, cats etc etc. System took about 45 minutes to run. Good thing about this was, that it WAS totally automatic, one row in root's crontab. Bad thing was, that it took ages to debug when everything when wrong again. Documents..? Something you eat?
After a while I created a system of my own, takes about 10 seconds to run... Again not so Unix-ish, but I prefer the new one.
Admin
Um, nitpick - Until fairly late in the mysql 3.xx series Mysql didn't do joins via JOIN (you had to fudge via where clauses).
I had to deal with server running an old version MySQL without the proper SQL JOINs, drove me batty for a while but then the box had been running non-stop since 1999.
Admin
1. 'brainfuck' ???
2. The point I was making was not that all tools are appropriate (except for a few select kinds of systems, who really programs in assembly anymore?), but that given a particular tool, an implementation for a given task can be done both with and without WTF's; it's the person holding the hammer, not the hammer...
Admin
Yes, brainfuck. As in http://www.muppetlabs.com/~breadbox/bf/
Admin
4. <b>Reverse</b> indentation. Yes, that's right... you would see a function name about 3 tabs in, and then the body of code stuck right on the margin.
We truly are in the looking glass at this point....
Admin
er, <i>through </i> the looking glass.......
Admin
The orginal digs dinner isn't perl, in fact I'll wager he wrote a perl script to replace it in a handful of lines.
He says shell scripts, and then that it calls sed, awk and grep.. These are what perl replaces with a nice powerful general purpose language, together with CPAN, Best Practices, Unit Tests, Quality Metrics, Automated testing, logging, and cross-platform capabilities, not to mention the world leading Template Toolkit, etc.
Dumb ass!
Admin
That made my week :)
Admin
As an owner of 2 cats, I take offense to this: "Shooting a cat in the face"
Why not say "Shooting a dog in the face" next time, just to even things out?
Admin
Maybe it's a watergun...
Admin
I actually work on a legacy system for a major financial institution, where the exact same kind of obfuscation is acheived. Their problem is the system has evolved over the years from proprietary formats to more open types, and from a complete UNIX environment (workstations and server) called DNIX to Windows workstations and SCO UNIX servers.
Note that penguin-types were not involved in this construction (except that we now maintain and update it). It sure gives my script maintenance skills a work out. 8-)
Admin
Speaking about not knowing your technology. Also a classical case of 'I know syncsort and do not want to learn how to make use of optimizer, indexes or whatever a database provides'..
Admin
Nonsense! You obviously have never seen a Perl script. If it had been Perl the op would not have been able to *read it*! ;->
Admin
Dunno what you guys are squawking about. Some people I know would call this and writing VBSCRIPT ASP pages "Job Security".
;-)
Admin
Not just cat, see the Useless Use of Cat award:
http://laku19.adsl.netsonic.fi/%7Eera/unix/award.html
Admin
It needs more links in the chain...
doQuery.ksh | tee saveQuery.txt | parseQuery.sh | tee saveParse.txt | formatOutput.bf | tee saveOutput.txt |createXml.pl | tee saveXml.txt | mailOutput.bash | tee mailOutput.txt | mailXml.tch | tr "wtf" "WTF" | sed -e 's/[fF][aA][lL][sS][eE]/True/g' -e 's/^.*\(WTF\).*$/\1!!!/g' | awk '{/Paula/ printf("Brillant!");}' | tar cvf `date +'%Y%m%d`.audit.tar *.txt | compress `date +'%Y%m%d`.audit.tar
Admin
Hey, you got it all backwards. It already is "Enterprise sh" [is that Enterprishe ?]
Admin
[Pro forma]The real WTF is[/Pro forma] blaming Unix or Unix developers for the debacle. This one looks to me like a Windows developer thrown in the deep end; since Windows people do not do much batch scripting, they generally do not have a feel for modularity.
Anyone used Monad, the new Windows shell environment? It looks to be the equal of any Unix scripting language for this sort of thing...
Admin
Last I heard, Monad was not going to follow Unix's approach of scraping randomly formatted text.
Admin
since when is that the Unix philosophy? I seem to remember the philosophy being "Make simple tools that have a single function. Do complicated things by combining these simple tools." Thus grep, cat, sed, cut, awk, etc are all the simple tools, and piping them together in a rediculous chain inside bash is the method of combining them.
This is exactly what I expect from a classic "UNIX" solution, where all the data is stored in files and directories.
Databases and fancy programming languages are the wave of the future. I call them the "Linux" solution, so as not to confuse things with all the crap that went on in the elder UNIXes.