Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

simple_shell

A small UNIX command-line interpreter written in C, modelled on sh. Built as a pair project with Ebube Ochemba during the ALX Software Engineering program.

What it does

  • Shows a prompt and reads commands in a loop, in interactive mode or from a pipe (echo "ls -l" | ./hsh)
  • Splits each line into the command and its arguments
  • Searches the PATH environment variable to find the program, then runs it with fork and execve and waits for it to finish
  • Handles the exit and env built-ins
  • Prints an error when a command isn't found

Files

File What it does
main.c Prompt loop and exit handling
token_handling.c Splits input into arguments
find_path.c Resolves a command through PATH
executing.c fork / execve / wait
builtin.c Built-in commands
enviroment.c Environment variable helpers
functions1.c, functions2.c Our own string functions (_strcmp etc.), since the project limited which standard library calls we could use

Build and run

gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh
./hsh

Authors

See AUTHORS.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages