Results 1 to 9 of 9

Thread: Why "echo?" (origin)

  1. #1
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default Why "echo?" (origin)

    Just out of curiosity, why does php (and now I've noticed batch files too) use "echo" as the command to output text.
    It kinda makes sense, but certainly less than print, output, write or any other number of commands would.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33
    Just out of curiosity, why does php (and now I've noticed batch files too) use "echo" as the command to output text.
    I don't know exactly, but I should think that it originates from "echo mode" in terminals. When data is sent to a server, the server "echoes" the data back to the terminal.

    It kinda makes sense, but certainly less than print, output, write or any other number of commands would.
    Agreed.

    Mike

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It makes sense when executing the script interactively, as the script will literally "echo" back the parameter(s) to the user.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    It makes sense when executing the script interactively, as the script will literally "echo" back the parameter(s) to the user.
    That's quite a stretch. If what the user sees is only an echo, where's the original being sent?

    Echo mode (which in batch files is also controlled by the echo command) is all about replaying the commands sent to the shell, so it's a sensible name. Another command name could easily have been used for displaying messages.

    Mike

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Hmm?
    Code:
    $ echo Some text
    Some text
    Original in red, echo in green.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    Hmm?
    Code:
    $ echo Some text
    Some text
    Original in red, echo in green.
    That's not what I asked (and it was a rhetorical question, at that), nor is it echoing. Repeating the entire line, command included, would be, as that is what's being sent to the command interpreter.

    Mike

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I've spurred a debate!
    //watches.

    Yeah... I can see why it kinda makes sense, as I said before, but just not sure who would've thought of that as the name for it. But the echo mode thing makes sense (though, who named echo mode? )
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    "Echo" is a city you know.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    And a car. Perhaps programming just a marketing scam.
    Next, we'll be using the honda command to connect to a database, and the ford command to duplicate a string....
    I need sleep...
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •