Difference between revisions of "OPS235 Scripting Exercises"

From CDOT Wiki
Jump to: navigation, search
(Created page with "= Things you need to know = == Terminal vs script file == A shell script is nothing more than a sequence of shell commands. Any command you put in a shell script can be exec...")
(No difference)

Revision as of 10:58, 10 January 2020

Things you need to know

Terminal vs script file

A shell script is nothing more than a sequence of shell commands. Any command you put in a shell script can be executed just as well in a terminal. In fact no matter how complex your script is - you can run the entire thing from a terminal window without executing the script.

Runnning a command

  • How to run a command in the current directory or another directory or a directory in the $PATH
  • That programs you run need to have execute permission
  • What your $PWD is, pwd command
  • Check the return code from a command by examining $?

Variables

  • How to create a variable and set a value in it
  • How to get the value from a variable

Quotes

  • Why use single or double quotes
  • The difference between single and double quotes
  • Backquotes

Redirecting output

  • How to redirect output from a command to a file
  • How to pipe output from one command to another command

Exercises