UNIX Shell-Scripting Basics [Presentation2Go.com]_2

Download UNIX Shell-Scripting Basics [Presentation2Go.com]_2

Post on 22-Oct-2014

12 views

Category:

Documents

6 download

Embed Size (px)

TRANSCRIPT

UNIX Shell-Scripting Basics

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

AgendaWhat is a shell? A shell script? Introduction to bash Running Commands Applied Shell Programming

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a shell?

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a shell?

/bin/bashwww.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a shell?

#!/bin/bashwww.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a shell?INPUT

shell

OUTPUT

ERROR

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a shell?Any Program But there are a few popular shells

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

Bourne Shells

/bin/sh /bin/bash Bourne-Again Shell

Steve Bournewww.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

Other Common ShellsC Shell (/bin/csh) Turbo C Shell (/bin/tcsh) Korn Shell (/bin/ksh)

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

An aside: What do I mean by /bin ?C Shell (/bin/csh) Turbo C Shell (/bin/tcsh) Korn Shell (/bin/ksh)

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

An aside: What do I mean by /bin ? /bin, /usr/bin, /usr/local/bin /sbin, /usr/sbin, /usr/local/sbin /tmp /dev /home/borwicjh

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a Shell Script?A Text File With Instructions Executable

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a Shell Script?% cat > hello.sh < hello.sh < /tmp/myfile cat >> /tmp/myfile cat 2> /tmp/myerr cat < /tmp/myinput cat < /tmp/x 2>&1

INPUT 0 env OUTPUT 1 ERROR 2

www.wfu.edu/~borwicjh/presentations/UNIX%20Shell-Scripting%20Basics.ppt

What is a Shell Script? How To Run% cat > hello.sh < hello.sh < hello.sh < hello.sh < test.sh

Recommended

View more >