Skip to content

danaZo/Advanced-Programming

Repository files navigation

Advanced-Programming

Advanced Programming course assignment 1

Created By:

MyShell is a shell program developed as part of our Advanced Programming course assignment. The program is designed to interpret and execute user commands in a simulated shell environment. It includes features commonly found in Unix-like shells,such as command execution, redirection, pipelining, handling variables, and control flow.

Getting Started

Prerequisites
  • GCC compiler
  • A Unix-like environment
Compilation

To compile the shell program, use the following command in your terminal:

make
Running the Shell

To start the shell, run:

./myshell

Features and Commands

The shell supports a variety of commands and features as described below:

  1. Command Execution

    • Execute commands with arguments.
    hello: ls -l
  2. Background Execution

    • Execute commands in the background using &.
    hello: ls -l &
  3. Redirection

    • Redirect output to a file using >.
    hello: ls -l > file
    • Append output to a file using >>.
    hello: ls -l >> mylog
    • Redirect standard error using 2>.
    hello: ls -l nofile 2> mylog
  4. Pipelines

    • Use pipes to direct the output of one command as the input to another.
    hello: cat myfile | grep "search_term"
  5. Variable Handling

    • Set and use variables.
    hello: $person = David
    hello: echo $person
  6. Read Command

    • Prompt for input and store in a variable.
    hello: read name
    hello: echo $name
  7. Command History

    • Navigate through recent commands using the up and down arrow keys.
  8. Control Flow

    • Implement if-else conditions.
    if date | grep Fri
    then
      echo "Shabat Shalom"
    else
      echo "Hard way to go"
    fi
  9. Change Prompt

    • Change the command prompt display.
    hello: prompt = myprompt
  10. Change Directory

    • Change the current working directory.
    hello: cd mydir
  11. Repeat Last Command

    • Repeat the last executed command using !!.
    hello: !!
  12. Exit

    • Exit the shell using quit.
    hello: quit
  13. Interrupt Handling

    • Handle Ctrl-C interrupts gracefully, printing a message rather than terminating.

About

Advanced Programming course assignments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •