LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Create a user defined shell in Ubuntuusing c program (https://www.linuxquestions.org/questions/linux-newbie-8/create-a-user-defined-shell-in-ubuntuusing-c-program-902399/)

parmishr 09-11-2011 03:12 AM

Create a user defined shell in Ubuntuusing c program
 
I am using ubuntu flavour of linux operating system i wanted to know how we can create an user defined shell through c program

Nylex 09-11-2011 03:21 AM

Write one? Why do you want to write a new shell? You're really going need to give more details about what you want to do.

parmishr 09-11-2011 03:28 AM

i am givin the following c code so that the $ prompt which comes default gets changed but my code is not working

#include<stdlib.h>
int main()
{
while(1)
{
system("PS1=\"FTS>\" bash" );
}
return 0;
}

i want FTS> to come instead of the $ prompt

Nylex 09-11-2011 03:32 AM

Why on Earth are you trying to write a C program for this? There's no need to write a program just to change your prompt. This has nothing to do with creating a new shell.

You just set the PS1 variable and it will change the prompt for your current shell. If you want a permanent change, then put it in your ~/.bashrc.

parmishr 09-11-2011 03:34 AM

i want to implement more things in that code thats why i want to write c program on that,
can u please help me out with it.....

Nylex 09-11-2011 03:35 AM

What exactly do you want to do? If you want to create a new shell, then look at the source code for Bash, Tcsh, or any other shell.

parmishr 09-11-2011 03:35 AM

can u please tell me how to create a new user defined shell in c program..

Nylex 09-11-2011 03:35 AM

Please write words out in full.

parmishr 09-11-2011 03:36 AM

sir im extremly new to this os i have very limited information regarding all this commands if u can help then it would be really great.

Nylex 09-11-2011 03:37 AM

You still haven't explained exactly what you want to do. Why do you want to create a new shell? I suspect that's not what you want to do, but you're not exactly helping us to understand what it is you want.

Please write words out in full and use punctuation, because it's difficult to read posts without it.

parmishr 09-11-2011 03:41 AM

OK,
Sir let me start from the beginning, i want to create my own shell in which i can execute my own user defined commands.
since I'm new to this OS i don't have enough knowledge of the terminology used here.

Nylex 09-11-2011 03:42 AM

What exactly do you mean by "user defined commands"? Are they just programs you've written? Why do you need a new shell for that? Again, you should probably look at how, e.g. Bash works..

parmishr 09-11-2011 03:47 AM

user defined command means fr eg: for ls command i want to give myls which will work like "ls" but in my own shell which i have created.
i want to do this so as to learn creation of shell and want to create my own commands.

EricTRA 09-11-2011 03:52 AM

Hello parmishr and Welcome to LinuxQuestions,

I'm under the same impression as Nylex that you are complicating things way to much. Why would you reinvent the wheel? If it's only for learning purposes, great! But if you want to learn from scratch on how to 'create' your own shell, why don't you, as already told by Nylex, download the source of one of the shells available, for example Bash, investigate that source code, adapt it to your needs and compile. Then you would have 'your own commands' in a shell. Another way to have your 'user-defined commands' is to work with aliases.

@Nylex: if the cake means what I think it means... Happy Birthday!

Kind regards,

Eric

parmishr 09-11-2011 03:58 AM

ok i will do that also i mentioned one code above can you just correct it so that i can get the FTS> prompt.
that will be a big help
regards


All times are GMT -5. The time now is 02:38 PM.