script

  1. why do scripting
    • automated maintenance
    • automated reports
    • schedule when needed
  2. What kind of command language
    interpreted command language
  3. How many shell script UNIX commands to preform a task
    It can contain multiple commands
  4. An executable premission and is in the path name. What do you write at the command prompt
    $ myfile
  5. If it had executable permission and is not in the path name, how do you specify the path
    $ ./myfile
  6. It does not have executable permission
    $ sh myfile
  7. To make it an executable file
    for everyone
    a
  8. for the owner
    u
  9. for the group
    g
  10. others outside the group
    o
  11. File permissions
    read
    r
  12. write
    w
  13. execute
    x
  14. none
    -
  15. permissions can be
    added
    +
  16. denied
    -
  17. explicitly set
    =
  18. to view current permissions
    ls -l
  19. to change premissions
    chmod
  20. All programs including scripts can be written using a combination of 3 structures.
    Sequence
    execute the commands in order
  21. selection
    • if then or if then else statements
    • test for a criteria
  22. looping
    repeat a set of instructions, until the criteria is met and number of times
  23. cat -n
    the files with line numbers
  24. in the file what does this mean #
    Its a comment line and not executed
  25. what does command display
    date
    current date and time
  26. pwd
    current working directory
  27. wc
    count words lines and characters
  28. cp
    copy a file
  29. echo"any text"
    displays the info after the echo
  30. echo "no text"
    makes blank line
  31. read var1 [var2 var3]
    accepts the keyboard data and places it in one or more variables
  32. how to use data in a variable
    $var1
  33. exit[number]
    • end of the program and stop it
    • can assign error code of 0 means successful
  34. what is a variable
    • a memory location that has a name and stores a piece of data called a value
    • can store text, number or other type of data
  35. can a variable be changed in a script as it runs
    yes
  36. what is iggnored by unix
    #
  37. Run the script and save the data in a file, overwriting any data already in the file
    $ sh won3> capturefile
  38. •Run the script and save the data in a file, appending the data at the end of any data already in the file
    $ sh won3>> capturefile
  39. •Run the script, display the data to the screen and save the data in a file, overwriting any data already in the file
    $ sh won3 | tee capturefile
  40. when running $ sh box 10 20 each is assigned a variable number
    • $ is value box
    • $1 is vlue 10
  41. reads commands but doesn’t execute them
    sh -n
  42. shows the shell input lines as they are read
    sh -v
  43. shows the commands and their arguments as they are executed
    sh -x
Author
Tjr31
ID
52560
Card Set
script
Description
part 1
Updated