ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need to do my own bash interpreter.
I dont know where to start.
I have 1 month to do it.
I need to do that when i open a terminal window my own bash is seted to default bash interpreter and when i write some specifics commands it's be interpreted for it.
Sorry for the english...
Read those pages to get a basic idea how a shell works. If you already know Bash scripting it shouldn't be a problem to adapt that knowledge to it.
If you first have to learn Bash scripting I would think it is impossible to achieve this task in only one month, except may be for a very basic script that just sends the input to a Bash shell and directs the output to stdout.
Read those pages to get a basic idea how a shell works. If you already know Bash scripting it shouldn't be a problem to adapt that knowledge to it.
If you first have to learn Bash scripting I would think it is impossible to achieve this task in only one month, except may be for a very basic script that just sends the input to a Bash shell and directs the output to stdout.
I dont need to do a big shell, only some modules a recognize some commands.
i understand the idea of : http://people.clarkson.edu/~jmatthew/os/homework/shell/ but i dont realize how to set my own sheel script to default bash.
You can use the chsh command to change the default shell for your user. I would recommend to try that on a different user first, especially when you are using a system without root user, like Ubuntu, so that you don't accidentally lock yourself out.
well implementing a primitive shell in bash isn't that hard; start with commands read and eval
PS: or perhaps what you really want is executing a script automagically whenever you login?
I will try to make a pseudocode or something that explain you the idea :
Start ubuntu 1st time.
run some command that install or something my shell and set my shell as default.
exectute some commands that my shell have to interprete(like ls or some process).
run some background proccess to read some config files and do something when this configs change.
write on a file all command that was typed for the user on the prompt.
delegate some command to bash.
unistall my shell and restore the default shell.
I would like to know if there are some file like autoexex.bat of window where i can put some line to tell to linux that i want to set my own shell as default.
is there any body that understand spanish?
Last edited by javibishop; 09-14-2012 at 03:29 PM.
Shells read specific files when they start up. Each shell has its own set/sequence of config files that are read, and which ones are used depends on the type of startup (login vs. non-login). Your shell can similarly configure itself according to your design.
When a user logs in, the default process to be launched is identified in /etc/passwd. Usually, that will be a shell, but it can be anything you want it to be. If you want your own shell to be started on login for a particular user, you use the /etc/passwd file to do so.
Thanks for all answers! I watched the video on youtube and im starting to try.
Im sure i will post soon.
Javier
Hello again...i try this steps :
I made a simple script and i modified the passwd file to use for my user my bash script. When i press ctrl + alt + f1(this is an login terminal no?) i put my user and pass and its start to run my bash script.
Is there any way to this script start to run when i press the icon terminal on ubuntu taskbar? I am a little confuse with this two type of terminals. One of this is a non-login terminal and the other is a login terminal?
This is the rigth way to put my bash script as a default bash interpreter?
What i have to do if i want that this script start to running every time that i open the terminal from the taskbar?
Javier
Last edited by javibishop; 09-17-2012 at 01:54 PM.
I have a hard time following the logic of your requirement. If you have a program of some sort that runs whenever the user logs in, does the program allow some way of invoking a second login? What would you expect to happen? It seems a lot like simply running bash from a bash commandline. It can be done, but has very little purpose.
Also, I think the way you are using terminology may be contributing some confusion. You use the the term 'bash interpreter', which seems unusual. When we refer to bash it is normally referred to as a shell. The term 'interpreter' usually implies some kind of programming language, or at least something capable of handling exec's she-bang (#!) syntax. Although bash is technically one of those, the use of the terms bash and interpreter together is uncommon and slightly redundant. Do you mean simply a bash script?
If your question is about running a bash script automatically, then the Bash Reference Manual, 6.2 Bash Startup Files should answer your question. You seem to be asking about 'interactive non-login shells'.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.