# Who's developed their console?



## kr651129 (Sep 12, 2012)

Just wondering, has anyone here developed their own *BSD console?  I was thinking about this as a learning project.

What language did you use?  Did you find it more or less difficult than you thought?  Any tips for someone who wants to write their own?


----------



## xibo (Sep 12, 2012)

A console is a device interface, usually used as synonym for "serial interface" 

The *BSD command line interface consists of two halves that are to be considered distinct: The shell and the terminal.

A shell is a process that parses and eventually interprets (if parsing was successful) text input, launches "commands", and so on.
A Terminal is an interface to the Shell process. It will provide text input to a shell (which is usually the terminal's child process) and process output produced or forwarded by the shell.

There are numerous shells in the shells directory of the ports collection, while ssh(1) (source in the crypto/openssh subdirectory of the FreeBSD source distribution) and telnet(1) (contrib/telnet) are (some of) the userspace terminals provided in BSD.


----------



## NewGuy (Sep 13, 2012)

*Shell*



			
				kr651129 said:
			
		

> Just wondering, has anyone here developed their own *BSD console?  I was thinking about this as a learning project.
> 
> What language did you use?  Did you find it more or less difficult than you thought?  Any tips for someone who wants to write their own?




If you mean developed their own shell, I did that a while back, though it was on DOS, not BSD. At the time I was using UNIX at school, but was stuck with Windows at home. The Windows command line shell was pretty basic then and so I wrote my own with basic command line editing, history and simple substitution. It was an interesting project and made working from within DOS easier.

At the time I used Turbo Pascal, though if I were going to do a similar project on FreeBSD I'd use C. As for difficulty, it was about what I expected. There were a few little "gotchas" which interpreting input, but nothing too serious as I only wanted a few simple features.

My advice would be to start small. Get something bare bones set up, just something ta will let you type and run commands. Then slowly add to that. Don't design a great big, bash or tcsh replacement, those are complex tools. Start small and slowly tack on new features.


----------



## fluca1978 (Sep 14, 2012)

I teached Unix when working for university, and had written a program that was a kind of mini shell to demonstrate students how to pipeline, start, kill and so on commands. 
A console is a different kind of beast, it is a kind of hardware driver, so much more low level.
What should be the purpose of writing an own shell/console?


----------



## kr651129 (Sep 15, 2012)

fluca -- the purpose is just to learn, basically the same reason you wrote the program.  I know I can create a gui in c that takes input and I can echo system() calls but that's cheating and really slow.


----------



## noobster (Sep 15, 2012)

If you're looking to write your own shell, this may be a useful starting point: Implementing a Shell


----------

