This is a Unix shell program
A shell is simply a program that conveniently allows you to run other programs
This shell supports the following commands:
- The internal shell command
exit
which terminates the shell - A command with no arguments
- Example:
ls
,cp
,rm
- System calls:
fork()
,execvp()
,exit()
,waitpid()
- Example:
- A command with arguments
- Example:
ls –l
- Example:
- A command, with or without arguments, executed in the background using &.
- Example:
gedit &
to run in the background orgedit
to block terminal until finish - Details: In the case of
gedit &
, the shell must execute the command and return immediately, not blocking until the command finishes. - Concepts: Background execution, signals & signal handlers
- Example:
- Shell builtin commands
- Commands:
cd
&echo
- Details:
cd ~
cd ..
cd <absolute_path>
cd <relative_path_to_current_working_directory>
echo "wow"
=> wow
export x=5
echo "Hello $x"
=> Hello 5
- Commands:
- Expression evaluation
- Commands:
export
- Details: Set values to variables and print variables values. No mathematical operations is needed.
- Export Details: Accept input of two forms, either a string without spaces, or a full string inside double quotations.
- Example:
export x=-l
ls $x
=> Will performls -l
export y
="Hello world"
echo "$y"
=> Hello world
- Commands: