Reputation: 1574
I have created a customized shell in C++. Currently, the shell is designed as an infinite while loop that is started by running the corresponding executable from the terminal (I am using Ubuntu as my OS). The shell implements a few new commands that are each stored as separate executables in the file system. The rest of the commands that the user enters are directly executed using the execve()
wrapper function.
So, essentially, I am executing all the user commands by using the execve() function: the customised commands are stored as separate exectuables and are "exec
ed" by providing the path to the executable whereas any other "standard" unix command is directly exec
ed.
Instead of running it as a separate executable from bash
, I want to make the user use my shell that executes on the terminal. How can I do that?
I referred to the following links:
Processes and Sessions and Controlling Terminals
However, I am unable to figure to out the links like association between a controlling terminal and the shell etc. Any help would be appreciated in this regards.
UPDATE:
This may sound a bit illogical but:
Is there any way to implement it as a user command that the user can execute from the current shell?I know there is a command called chsh... but will it work with my shell?
Upvotes: 1
Views: 156
Reputation: 123410
First you can test your shell from bash with exec yourshell
. This replaces the bash process with your shell entirely. (When you exit your shell, the terminal will exit/logout with it.)
You can also run xterm -e yourshell
to start an xterm with your shell instead of bash.
If you want to permanently make it your default shell:
/etc/shells
chsh
Upvotes: 1