custom UNIX shell

Solaris, RedHat, FreeBSD and the like
Post Reply
Message
Author
spt60
Junior Member
Junior Member
Posts: 250
Joined: Thu Feb 08, 2007 8:59 am
Location: OH

custom UNIX shell

#1 Post by spt60 » Tue Oct 20, 2009 8:13 pm

Hi I'm learning about UNIX shell using Ubuntu 9.04. I'm wondering how a "cd <directory>", "dir <directory>" and "printenv" in bash shell work and try to replicate it.

It doesn't have to be as complex but I wonder how to code it. Basically when running my own shell program such as "ishell cd <directory>" it will change the current default directory to <directory> and also change the PWD environment variable; and "ishell dir <directory>" will list the content of the directory; "ishell env" will list all the environment strings.

Thanks! :wink:

Temetka
Senior ThinkPadder
Senior ThinkPadder
Posts: 2790
Joined: Fri Sep 30, 2005 3:27 am
Location: Glendora, CA

Re: custom UNIX shell

#2 Post by Temetka » Sun Oct 25, 2009 1:37 am

How much shell scripting experience do you have and also how many years of experience do you have as a programmer / linux admin in general?

New shells are hard to code.

You could create your own scripts, rename to the original commands and have the original commands renamed then called from the script. That is a very circular, and pointless method do use your ishell command, but it would work.

To what purpose are you trying to accomplish with this.
New:
Thinkpad T430s 8GB DDR3, 1600x900, 128GB + 250GB SSD's, etc.
Old:
E6520, Precision M4400, D630, Latitude E6520
ThinkPad Tablet 16GB 1838-22U
IBM Thinkpad X61T, T61, T43, X41T, T60, T41P, T42, T410, X301

Volker
Junior Member
Junior Member
Posts: 482
Joined: Fri Oct 01, 2004 10:21 am
Location: Dublin, Ireland
Contact:

Re: custom UNIX shell

#3 Post by Volker » Sun Oct 25, 2009 8:18 am

Oh boy :Nice:

The shell uses the posix C api to list directories and set environment variables. For example, directory listing is done with http://en.wikipedia.org/wiki/Dirent.h.

spt60
Junior Member
Junior Member
Posts: 250
Joined: Thu Feb 08, 2007 8:59 am
Location: OH

Re: custom UNIX shell

#4 Post by spt60 » Sat Oct 31, 2009 10:55 am

Volker wrote:Oh boy :Nice:

The shell uses the posix C api to list directories and set environment variables. For example, directory listing is done with http://en.wikipedia.org/wiki/Dirent.h.
Thanks for your input. This should do the trick. If not I'll be back bugging you :D

Post Reply

Return to “Linux Questions”

Who is online

Users browsing this forum: No registered users and 0 guests