Lecture6

Lecture6 - Lecture 6 Introduction to Shell Programming COP...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 6 Introduction to Shell Programming COP 3344 Introduction to UNIX 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What is a shell script? • An executable file containing – Unix shell commands – Programming control constructs (if, then, while, until, se, for, break, continue, while, …) case, for, break, continue, while, …) – basic programming capabilities (assignments, variables, arguments, expressions, …) • The file entries are the script • The file is interpreted rather than compiled and executed – The first line of the script indicates which shell is used interpret the script 2 to interpret the script
Background image of page 2
Simple script (egshell.sh) #!/bin/sh this is the script in file egshell sh #this is the script in file egshell.sh cal date who | grep liu exit • The “#!” is used to indicate that what follows is the shell used to interpret the script • The “exit” command immediately quits the shell script (by default it will also quit at the end of the file) 3 q)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Executing shell scripts • sh myscript #uses Bourne shell sh myscript uses t hell • tcsh myscript #uses t-cshell ote that the above explicitly invoke the appropriate Note that the above explicitly invoke the appropriate shell with the file containing the commands as a parameter. The file does not need to be executable.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/23/2008 for the course COP 3344 taught by Professor Sudhir during the Spring '08 term at FSU.

Page1 / 12

Lecture6 - Lecture 6 Introduction to Shell Programming COP...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online