Microsoft Word Bourne Shell Scripting docx



Yüklə 14,61 Kb.
Pdf görüntüsü
tarix08.10.2017
ölçüsü14,61 Kb.
#3726


Bourne  Shell  Scripting  

 

 



Introduction  to  BASH  Command  Line  Interface  (CLI)  

o  Identify  BASH  installation  &  key  configuration  files  on  RedHat  &  

Debian  GNU/Linux  distros  

§

 



.profile/.bash_profile/.bashrc/.bash_history  

o  Identify  &  use  common  built-­‐in  BASH  commands  

(pwd,cd,set,unset,export,source,etc.)  

o  BASH  Command-­‐line  Expansion  

§

 

Brace  Expansion  



§

 

Tilde  Expansion  



§

 

Parameter  &  variable  Expansion  



§

 

Command  Substitution  



o  BASH  Reserved  words  

o  BASH  History  identification  &  configuration  

o  Aliases  (ls,du,df,rm,cp)  

o  Backticks  -­‐  command  expansion  &  execution  

o  BASH  Prompt  configuration  

o  Command  chaining  

o  Error  level/Return  code  (Command  Exit  Status)  identification  

o  Conditional  execution  of  subsequent  commands  (&&,||)  

 

Redirection  |  Error  Handling  



o  Standard  Input  

§

 



Direct  input  from  STDIN  (Standard  Input)  

§

 



Redirect  input  from  a  file  

o  Standard  Output  

§

 

Direct  output  to  STDOUT  (Standard  Output  )  



§

 

Redirect  output  to  a  file  



§

 

Append  Standard  Output  to  an  existing  file  



o  Standard  Error  

§

 



Explore  STDERR  attributes  

§

 



Redirect  Standard  Error  

o  Input/Output  (I/O)  Redirection  

§

 

Pipes  



§

 

Sequential  execution  via  pipes  



o  Quoting  &  Escaping  

 

BASH  Scripting  



o  Basic  Script  definition  (hello  world),  permissions  modification  &  

execution  

o  Internal  BASH  variables  

o  Global  Variable  definition  

o  Function  definition  

o  Local  Variable  definition  -­‐  function  scope  




o  BASH  Arrays  

o  Loops  

o  Menu  creation  using  Select  

o  Job  control  -­‐  Foreground/Background  processing  

o  Conditionals  

o  Case  -­‐  Concise  Conditional  Branching  

o  Positional  Parameters  

 

BASH  Script  Definition  



o  Create  BASH  script  to  move  multiple  files  to  new  names  defined  by  

positional  parameters  

o  Create  script  to  monitor  directory  for  file  changes  and  report  the  

differences  via  E-­‐mail  to  Administrator  

o  Create  script  to  monitor  directory  size  and  report  threshold  

encroachment  to  Administrator  via  E-­‐mail  

o  Define  script  to  parse  logs  for  keywords  and  notify  the  Administrator  

via  E-­‐mail  

o  Create  script  to  monitor  network  connectivity  between  hosts  and  

report  outages  to  Admin  via  E-­‐mail  

o  Define  script  to  monitor  process,  restart  if  fails,  and  E-­‐mail  

Administrator  at  defineable  limits  

o  Create  script  to  backup  sub-­‐directories  using  Tar  &  Gzip,  define  

threshold,  and  SSH  file  to  remote  host  

o  Log  the  output  of  BASH  scripts  to  a  Syslog-­‐like  format  

 

BASH  3.x  Updates  



o  Explore  BASH  3.x  on  multiple  platforms:  

Linux|Solaris|MacOSX|FreeBSD  

o  Compare  and  contrast  to  BASH  2.x  

o  Execute  BASH  2.x  commands|scripts  within  BASH  3.x  on  multiple  

platforms  

o  Evaluate  results  



 

Yüklə 14,61 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə