Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
C
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
docs
src
test
README

README

# README for Hank Shell (Hsh)
# Hsh is a simplified version of BASH.

[How to use hsh]:

(1) First you need to install gnu readline library: 
    
    $ sudo apt-get install libreadline6 libreadline6-dev

(2) Second you need to compile and install hsh:
    
    Run 'make' in the 'src/' sub-directory ==> $ make

[Hsh Features]:

(1) Below lists all (9) the builtin commands implemented in Hank Shell:

cd	 : change current working directory
dirs     : list pushed directories on the directory stack
exit	 : terminate exeucution of hsh
echo     : echo strings that follow this command
history  : show commands history
pwd      : print current working directory
pushd    : push directory onto a directory stack
popd     : pop directory from directory stack
path     : list command search paths from command paths list and add/remove path(s) from that list

(2) Builtin commands details:

cd [dir] : change directory to dir. If dir is omitted, change directory to home directory.

dirs	 : print directories pushed on directory stack; seperated by spaces.

exit	 : exiting hsh program. 

echo [s] : print whatever texts followed echo commands.

history [+n] : show n commands stored in command history list; if 'n' or '+n' is omitted,
	       hsh will list all the commands in command history.

pwd      : print current working directory

pushd [dir] : same as 'cd', but push current working directory onto directory stack 
	      while doing 'cd'. directory stack is a hsh internal data structure.

popd [-n] : opposite of 'pushd'. option '-n' specify how many entries from stack you want to pop.

path [+|-] [dir] : add or remove dir from directory path list. if both '+|-' and 'dir' arguments
		   omitted, hsh will print all the directories in the list. the list is a hsh
		   internal data structure.

(3) IO redirection:

Commands like 'cat < main.c > tmp' can be interpreted by Hsh!

(4) Pipeline with IO redirection:

Hsh can read pipes ('|')! 

Commands such as -

$ pwd | grep main | cut -b 1-10
$ a | b | c | d | e
$ cat < main.c | wc
$ tr 'A-Z' 'a-z' < main.c | tr -cs 'a-z' '\n' | sort | uniq | comm -23 - /usr/share/dict/words > tmp 2> err.txt

can be executed beautifully without any problems. Also notice that pipes in Hsh can pipe system utilities as well
as builtin commands!

(5) Environmental variables:

Two environmental variables are implemented, namely, HOME and PWD. Therefore,

$ echo $HOME
$ echo $PWD

can also be interpreted correctly.

(6) 'Globbing' for Hsh:

Yes! Hsh can do globbing! The followings

$ ls *.c
$ ls test[1-3].c
$ ls hsh.* | wc

are all doing what you are expecting them to do!
Something went wrong with that request. Please try again.