Skip to content

drpmma/Drpmma-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Myshell for Linux

Supporting the following commands

  • bg
  • fg
  • jobs
  • kill
  • &
  • > < >>
  • |
  • test
  • cd
  • umask
  • time
  • env environ
  • clear clr
  • set
  • unset
  • exec
  • help
  • exit
  • continue
  • shift
  • echo
  • myshell batchfile
  • $
  • other external command

bg

run jobs in the background

explain about background : the process can run in background while the shell can receive user I/O normally.

    bg %id OR bg id

fg

run jobs in the foreground

    fg %id OR fg id

jobs

display status of jobs in the current session

    jobs

kill

kill a process by id or pid

    kill %id OR kill pid

&

run jobs in the background

    COMMAND &

> < >>

(redirecct)

explain redirect : by redirect, user can send the output of command into files or capture input from files.

    COMMAND1 > FILE
    COMMAND2 >> FILE
    COMMAND3 < FILE

|

(pipe)

explain pipe : the output of a command can be used as the input of another command

    COMMAND1 | COMMAND2
    COMMAND1 | COMMAND2 | COMMAND3

test

check file type and compare values

    test -b FILE
    test -c FILE
    test -e FILE
    test -f FILE
    test -h FILE
    test -l FILE
    test -p FILE
    test -r FILE
    test -w FILE
    test -x FILE
    test INTEGER1 -eq INTEGER2
    test INTEGER1 -ge INTEGER2
    test INTEGER1 -gt INTEGER2
    test INTEGER1 -le INTEGER2
    test INTEGER1 -lt INTEGER2
    test INTEGER1 -ne INTEGER2

cd

Change the shell working directory

    cd
    cd /home/usr

umask

set or display file mode

    umask
    umask 0666

time

display the system time

    time

env environ

display all the environment variables

    env OR environ

clear clr

clear the terminal screen

    clear OR clr

set

set the environment variables

    set VAR
    set VAR VALUE

unset

unset the environment variables

    unset VAR

exec

replaces the shell with specified command

    exec ls

help

display the README doc

    help

exit

cause normal process termination

    exit

continue

return the value of $? to 10

    continue

shift

move popositional parameters

    shift OR shift n

$

get the environment variables or get the argument

    $HOME
    $PATH
    $1
    $?

myshell batchfile

Processes a batch file that contains a set of commands

    myshell FILE

About

It's a project for linux course.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages