Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does the kernel provide a TCP stack? Either way, you still need to write an editor with which to write programs that utilize those syscalls.



    echo "line" >> file
I really don't get the need for an editor.


If you have echo and the source code having an ed clone would be very convenient as it would double as a pager. Also, it would be much faster to edit the files.


This amuses me too. We had to bootstrap from nothing originally too. I think many have never learned the history or started from first principals.


> We had to bootstrap from nothing originally too.

I doubt that the original Unix was written without an editor, using only cat. Of course some earlier interactive system at one point did have to come up without an interactive editor... but still I'd think it's much more likely that the editor was written off-line and fed into the system on punched cards or tape rather than cat'ed from the terminal.

The original post only mentions the network and implicitly the keyboard as possible inputs, but of course the challenge would be much easier if you allowed a DVD, CD, or even floppy drive with drivers (which are part of the kernel). I think pretty much any historical bootstrapping of an interactive OS is much closer to this setting.


it had 'ed' the precursor to ex and vi editors. The terminal they used was paper so not quite ready for a visually oriented editor! (https://en.wikipedia.org/wiki/Teletype_Model_33) If you're stuck on a basic system or rescue shell, cat and echo are considerably more straightforward if you don't know how to use ed already.


I doubt they wrote ed in cat.


sorry I was unclear. I assumed those who created ed knew how to use it - but regular people not familiar with ed would tend to use cat and echo when stuck in a broken / bare system.


Of course they knew how to use it. But I don't think they wrote the first lines of ed in ed-on-the-live-system. It is much much more likely that they wrote them offline and imported the code from punched cards or via tape or whatever from another system.

For whatever it's worth, Wikipedia (https://en.wikipedia.org/wiki/History_of_Unix) says: "In about a month's time, in August 1969, Thompson had implemented a self-hosting operating system with an assembler, editor and shell, using a GECOS machine for bootstrapping." I'm sure there are more details to be had somewhere.


Yes.

Also accessible as a file, since everything is a file.

echo "foo" > /dev/tcp/host/port


/dev/tcp is ugly hack in bash, not something provided by kernel. nc is arguably the more canonical way of doing networking in shell.


If you have nc you just need to reimplement echo.c and the task is over, as you can fetch busybox in several ways.

Heck, a simple while loop over stdin would be enough.

From the K&R book:

    #include <stdio.h>

    int main(){

    int c;

    while((c =getchar()) != EOF){

    putchar(c);

    }

    }
Or just run nc from a < redirect, but, the shell could restrict that maybe.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: