Presentation is loading. Please wait.

Presentation is loading. Please wait.

John Carelli, Instructor Kutztown University

Similar presentations


Presentation on theme: "John Carelli, Instructor Kutztown University"— Presentation transcript:

1 John Carelli, Instructor Kutztown University carelli@kutztown.edu

2 Command line interpreter/user interface
Unix Shell Command line interpreter/user interface Common Shells: Bourne – sh Korn – ksh C shell – csh Bourne Again Shell – bash Debian Almquist Shell (dash) TC Shell (tcsh) Z Shell (zsh)

3 HOME PATH PS1 / prompt USER SHELL TERM CDPATH modify settings in .bash_profile hidden file: use ‘ls –a’ in your home directory to see it

4 env history set +/-o (turn shell options on/off) ignoreeof prevent (accidental) exit on Cntl-D noclobber prevent (over)writing existing file set –o (or +o) to see current options cdpath filec enable filename completion (tsh)

5 […] File substitution wildcard (any char. in [])
 > Output redirection  >> Output redirection, append  < Input redirection  | Pipe  * File substitution wildcard (zero or more)  ? File substitution wildcard (one char.) […] File substitution wildcard (any char. in []) `command` Command substitution ; Separate commands

6 Redirection Pipes Standard input Standard output Standard error
/dev/null (null device) ex: output.cpp Pipes ls /bin | grep sh

7 [] any character in the bracket ^ beginning of string $ end of string
? Single character * 0 or more characters [] any character in the bracket ^ beginning of string $ end of string ls /bin | grep sh$

8 Command Substitution Single quotes (back-tics) spawns a subshell
output of subshell command replaces “back-quoted” item echo `date` $() – newer syntax (bash) echo $(date) More history: !! is last command Cntl-P emacs mode (bash default) set –o emacs esc-K vi mode set –o vi

9 Shell Script: an executable (text) file that contains shell commands.
When the shell script is run, the commands in it get executed #!<shell_path> Must be executable! # comments Environment variables Local/Global variables export command ex: firstscript

10 cd, ls, pwd, echo, time, umask, …
help (bash built-ins)


Download ppt "John Carelli, Instructor Kutztown University"

Similar presentations


Ads by Google