![]() |
| | #1 |
| Registered User Join Date: Aug 2009
Posts: 1
| How to make a new shell I've been bitten by a linux bug and now want to develop a new shell of mine. I think I will modify the bash shell to begin with and learn how stuff works. If someone can give me some pointers about how to take the first few steps, it would be great. 1) I have downloaded the bash 4, source code. Things look a little daunting, I am not an uber lex/yacc/C hacker. 2) I want to develop a shell/modify the bash shell, such that I can specify a command/input that must be typed in the shell for it to start working. an example: say I made a shell called mystupidshell, and configured my system such that whenever someone logs in, thats the default shell. I want them to type in their name at the prompt first and then type in the commands they want to use like ls, cd.. if they don't type in their name and instead type in ls etc.. they should be shown a msg saying whats your name nd then move on to let them type in various commands. To do this where can I start in the bash code to analyze and make changes. Should I look at shell.c? Any pointers are greatly appreciated. Thanks |
| thebiggestbang is offline | |
| | #2 | |
| Guest Join Date: Aug 2001
Posts: 4,923
| Quote:
| |
| Sebastiani is offline | |
| | #3 |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,381
| I agree in principle, but something as complex as bash would take quite a while to completely "get." Reading through the code helps -- but don't feel bad if you don't understand everything.
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot |
| brewbuck is offline | |
| | #4 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Keep in mind that lex produces C source from an input file (ie, some of the source is autogenerated by lex). The input file, which contains a description of the scripting language used by the shell, is not part of the source because it is not needed to build it. You could also write someone at GNU and ask them for it.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is offline | |
| | #5 | |
| Super Moderator Join Date: Sep 2001
Posts: 4,680
| Quote:
If this is the first open-source project you've looked at, don't be initimdated. Any decent project will have lots of code, but a lot of that is to deal with special cases, ensure stability, small features, etc... The basic logic is probably quite simply once you can look past all that. It just takes some experience. However, if you're wanting to write a shell, you might want to learn about spawning process, interprocess communication, and ncurses. That's really all a shell is going to do - and if you understand that, understanding bash is just a matter of time. | |
| sean is offline | |
| | #6 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Bash doesn't use ncurses except on the QNX platform. It does use readline, for the command history, etc.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is offline | |
![]() |
| Tags |
| bash, c programming, shell |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Win32 Common Controls in C++, how do i make and use them? | C+noob | Windows Programming | 6 | 01-09-2006 11:53 AM |
| using YACC and lex to make your own shell... | YankeePride13 | Linux Programming | 2 | 12-28-2005 10:00 AM |
| 'functions' in make? | mart_man00 | C Programming | 1 | 06-21-2003 02:16 PM |
| How to make a simple shell? | ranger | Linux Programming | 0 | 03-31-2002 03:09 AM |