nuxx.net
Making, baking, and (un-)breaking things in Southeast Michigan.

nuxx.net

Okay, the POP before SMTP issue seems to be sorted out now. If you normally send mail through nuxx.net and you currently (or suddenly) aren’t able to, please let me know. Things should be working as before, where if you check your email with POP, then your IP is allowed to relay through SMTP for the next 30 minutes or so.

Yes, I know I dragged my feet on this, but I was being lazy.

Also, I need some help from someone who knows command line stuff better than I. I just can’t figure this out:

The command cat < file1.txt behaves as expected, echoing file1.txt to stdout. However, cat < file1.txt file2.txt does not do what I expect, and instead prints just file2.txt. What has to be done in order to pipe both file1.txt and file2.txt into cat? I just can’t seem to figure it out. Thanks. :)

10 Responses

  1. kevinblanchard June 21, 2005

    # cat file1.txt file2.txt

    1. c0nsumer June 21, 2005

      No, that doesn’t do it. That would cat both files… What I need to do is pipe two files to something via stdin. I normally do this using something like:

      tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp

      But I need to pipe two files into there. I’d imagine that I could maybe do:

      cat tcp.smtp open-smtp | tcprules tcp.smtp.cdb tcp.smtp.tmp

      But that just doesn’t seem like the best way to do it.

      1. kevinblanchard June 21, 2005

        okay sorry misunderstood. I thought you were just asking if there was a way to pipe 2 files to cat :)

        1. c0nsumer June 21, 2005

          Heh, naw… It was just an illustration using examples that everyone would have installed.

      2. c0nsumer June 21, 2005

        Hmm, the second works, but tcprules bitches about the content of open-smtp. I think that maybe prior to vpopmail writing open-smtp it feeds just the required lines in. Hmm. I’ll have to find some way around this… Might not be too hard.

      3. kevinblanchard June 21, 2005

        I’ll take a look further when I have some down time at work, but as far as I can tell
        cat tcp.smtp open-smtp | tcprules tcp.smtp.cdb tcp.smtp.tmp

        isn’t a bad solution if it works for you. Unless I am using perl, or some other scripting language other then shell script, I find shell script seldom has 100% clean ways (mileage may vary by use) to do more complicated tasks. If anything, functional is the main goal ;)

        1. c0nsumer June 21, 2005

          That works, but because of some extra timestamps (I believe) that vpopmail adds to the end of the lines in open-smtp, I did the following:

          #!/bin/sh
          cat tcp.smtp open-smtp | cut -f1 | tcprules tcp.smtp.cdb tcp.smtp.tmp

          At least it works.

  2. pulse_state June 21, 2005

    Just happened to be looking through…

    I don’t think there is a way to do it with one cat command. The closest way I could find to replicate the behaviour you wanted was to do this:

    cat < file1.txt ; cat < file2.txt

    There just doesn’t seem to be a way to get both files to go into the same instance of cat without “ambiguous redirect” errors. Then again, I did this under a Linux box, and I don’t run BSD. Still, it shouldn’t make that much of a difference.

    1. c0nsumer June 21, 2005

      It’s just normal shell stuff, so it doesn’t matter. And that doesn’t reflect the desired behavior… See the other reply I made here for info as to why.

      1. pulse_state June 21, 2005

        Oh, OK. Well, your new way of doing it:

        cat tcp.smtp open-smtp | cut -f1 | tcprules tcp.smtp.cdb tcp.smtp.tmp

        … would get the job done. It’s kind of kludgey, but it does work.

        I wonder where the documentation for command line redirects would be kept? I looked in the info and/or man pages for coreutils and cat so far, and found nothing.

Leave a reply