Skip to content

Antoniofdjs/holbertonschool-simple_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

100 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Holberton - Simple Shell

Table of Contents

Description

This was a simple recreation of a Unix command interpreter, capable of running basic commands. It mirrors a sh in a simple way.

Files

  • README.md - Contains a decription of the project.
  • AUTHORS - Contains the programs creators.
  • functions - Contains get_tokens, get_pathand my_exe functions.
  • main.h - Contains the header and function prototypes.
  • simple_shell.c - Our running shell program.
  • small_help_functions.c - Contains white_spaces, free_array and remove_newline functions.

Commands

Some of the commands our shell can run:

  • ls (-a, -l, -r and others) - list files in the current directory
  • pwd - prints the current working directory
  • rm (-r)- delete files
  • echo - prints to stdin or sends text to a file
  • cp - copy a file from one location to another
  • mv - move or rename a file
  • touch - create a file
  • cat - prints a files content
  • chmod - change a files properties (read, write or execute permissions)

Use

To compile, first have all files in the same directory.

The compilation used for this was:

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

In the terminal:

./hsh
/bin/ls
ls

To run commands in interactive mode (run commands from characters)

echo "ls" | ./hsh
echo "pwd" | ./hsh

To run commands non-interactive mode (runs commands from outside our shell)

Examples

juancalpz23@penguin:~/holbertonschool-simple_shell$ ls
get_path.c  main.h    README.md         simple_shell    stest
hsh         my_exe.c  remove_newline.c  simple_shell.c  tokens_to_args.c
juancalpz23@penguin:~/holbertonschool-simple_shell$ ./hsh
($) /bin/ls
get_path.c  main.h    README.md         simple_shell    stest
hsh         my_exe.c  remove_newline.c  simple_shell.c  tokens_to_args.c
($)exit
juancalpz23@penguin:~/holbertonschool-simple_shell$
juancalpz23@penguin:~/holbertonschool-simple_shell$ pwd
/home/juancalpz23/holbertonschool-simple_shell
juancalpz23@penguin:~/holbertonschool-simple_shell$ ./hsh
($) pwd
/home/juancalpz23/holbertonschool-simple_shell
($)exit
juancalpz23@penguin:~/holbertonschool-simple_shell$
juancalpz23@penguin:~/holbertonschool-simple_shell$ pwd
/home/juancalpz23/holbertonschool-simple_shell
juancalpz23@penguin:~/holbertonschool-simple_shell$ echo "pwd" | ./hsh
/home/juancalpz23/holbertonschool-simple_shell
juancalpz23@penguin:~/holbertonschool-simple_shell$ 

Resources

Credits

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors