• Little Bobby Tables (unregistered)

    Not surprised he passed on it, it's broken.

  • Decius (unregistered)

    That code has the weirdest fencepost error I've ever seen. I can understand getting 0-indexed and 1-indexed arrays backwards, but why would you ever expect a 2-indexed array?

  • eth0 (unregistered)

    And he could've reduced it to a single line:

    file="$(printf '%s,' "$WORKSPACE/ewprd"{1..118}"_$DATECODE.dmp" | head -c -1)"
  • (nodebb) in reply to Decius

    It was initialised with the 1 file

  • (nodebb) in reply to eth0

    Nice use of head to remove the trailing comma

  • glennj (unregistered)

    And since there is no $i_ variable, we want this:

  • Ann (unregistered)

    my eyes...

  • rwa (unregistered)

    file=$( jot -w $WORKSPACE/ewprd111_$DATECODE.dmp 118 | tr -s \n , | sed -e 's/,$//')

    note: cut -c didn't work for me, not a linux box. {1..118} didn't work, not running bash. very very plain-vanilla bsd environment.

  • (nodebb) in reply to Decius

    So you are from the "comma is the terminator" camp.


    Or are you from the "comma is the begin marker" camp?


    Either way, you are definitely not from the "comma is the separator" camp, and you hate

  • löchlein deluxe (unregistered)

    comma comma comma chameleon, you come and go, you come and goooo.

  • doubting_poster (unregistered) in reply to DrOptableUser

    not sure what camp he's from, but you're certainly from the 'I don't bother reading all the code' camp.

  • (nodebb) in reply to doubting_poster

    And I respect you for managing to find time to carefully studying all the code that is presented on TDWTF. You surpass most of us who very selfishly only read the codez as long as they entertain us and skip the rest.

  • WTFGuy (unregistered) in reply to eth0

    @eth0: You seem very certain of which language or shell the code is written to. And don't forget this was running back in 2008, not in 2019. Was the {range} notation available way back then?

    I know I don't know. Perhaps you do.

  • Argle (unregistered)

    My first job out of college I worked primarily with a couple friends I went to school with. I was used to competence in programming with these guys. Second job, I got to discover how bad things got. One cow-orker came to me with 2 printed pages of a function he was writing and he wanted help figuring out what was wrong with it. I asked "what does it do?" He started explaining the code line by line. I stopped him and asked "20 words or less: what is this supposed to do?" The question seemed to shock him, but he thought about it and said "it's supposed to convert a string date to 3 integers with month, day and year." I asked, "are the inputs always sanitized? That is, 3 pairs of digits with a slash between?" He said it was. I scribbled a quick sscanf in the corner of his listing. "Try that instead." He came back a few minutes later saying it was working. I just shook my head. 2 pages of code. oy!

  • Barf4Eva (unregistered) in reply to löchlein deluxe


  • Lothar (unregistered) in reply to WTFGuy

    Even in 2008 file and FILE were two different variables.

  • Paul Neumann (unregistered)

    The script was rejected because it doesn't work. Consider ewprd117_$DATECODE.dmp -- It is in the $WORKSAPCE folder instead.

Leave a comment on “Classic WTF: The Backup Snippet”

Log In or post as a guest

Replying to comment #:

« Return to Article