How shell works - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

How shell works

Description:

How shell works – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 7
Provided by: yuk39
Category:
Tags: argv | shell | works

less

Transcript and Presenter's Notes

Title: How shell works


1
How shell works
  • Shell reads in input, parse process it, the
    resulting string is taken to be argv and
    executed
  • echo a ? shell sees echo aecho gets
    argvecho a, prints out a
  • ab echo a ? shell sees echo a, change it
    to echo becho gets argvecho b, prints
    out b

2
How shell works
  • ab bc echo \a? shell sees echo
    \ashell interprets \ as the char shell
    interprets a as bthe resulting string is
    echo becho gets argvecho becho
    prints out b on the screen
  • What if I want the value of b printed on the
    screen?

3
How eval works
  • ab bc eval echo \a? shell sees eval echo
    \ashell takes away evalshell interprets \
    as the char shell interprets a as bthe
    resulting string is echo bbecause of eval,
    shell parses this string once againshell
    interprets b as cecho gets argvecho
    cecho prints out c on the screen

4
Command Path
  • The shell variable path specifies where to
    search for commands
  • If not found, shells prints Command not found
  • To be very specific, use full pathname, such as
    /sbin/dumpon -v dumpdev

5
Notable Commands
  • vinum
  • swapon
  • fsck
  • mount ( fstab)
  • find

6
Difference between . And Sh
  • Both . script1 and sh script1 executes
    script1
  • Both have the same permanent side effect, such as
    the removal of a file
  • . does the work in the same shell
  • sh does the work in a separate shell
  • If what you want is the side effect within the
    shell, such as the value of a shell variable, use
    . instead of sh.
Write a Comment
User Comments (0)
About PowerShow.com