Sponsored Links

 

 

 

UNIX System Programming

Source: csserver.evansville.edu
Topic: Shell Programming


Short Desciption:
UNIX System Programming Lecture 4 BASH Shell Programming BLP: Chapter 2 BABS Outline: Redirection ... zsh, ksh Change your default shell to bash $ chsh -s /bin/bash 2 Our First Shell Script A ...

 

Content Inside:
UNIX System Programming Lecture 4 BASH Shell Programming BLP: Chapter 2 BABS Outline: Redirection Shell Programming Introduction The shell is a command interpreter and a full- featured programming language.  It is especially well-suited for system administration and for file, directory and process management. Several different shells are available: sh, bash, csh, zsh, ksh Change your default shell to bash $ chsh -s /bin/bash 2 Our First Shell Script A hello world example $ cat > hello #! /bin/bash # Prompt user for name echo -n "Enter your name: " read name echo Hello there $name! exit 0 $ chmod +x hello $ . /hello Enter your name: Elmer Fudd Hello there Elmer Fudd! $ 3 Our First Shell Script Start with a sha-bang (#! ) .  The kernel will automatically pass the script to the proper interpreter.  End with ìexit 0î (or non-zero exit to indicate an error condition) . Comments begin with a # Make the script executable and run it like a standard program OR you can also run the program like this: $ bash hello# run in new env (like . /hello) $ . hello # run in same env (also source hello) 4 Wildcards (globbing) Wildcard expansion is done by the shell.  Not by the application. A * matches any character except a leading dot (. ) .  A ? matches any single character. $ echo * a. 1 b. 1 c. 1 t2. sh test1. txt $ ls t? . sh t2. sh $ ls [a-c]* a. 1  b. 1  c. 1 $ ls {b*, c*, *est*} b. 1  c. 1  test1. txt $ ls *. {1, sh} a. 1  b. 1  c. 1  t2. sh 5 Redirection Every program automatically has three files/streams available: standard input, standard output, and standard error. In C, the FILE* streams are stdin, stdout, and stderr. In C++, the IO streams are cin, cout, and cerr. By default, they are connected to the keyboard, the display, and the display but they can be redirected. 6 Redirection Heres ...

 

add to Google Reader add to Google Bookmark add to bloglines add to newsgator add to FURL add to digg add to webnews add to Netscape add to Yahoo MyWeb add to spurl.net add to diigo Bookmark newsvine Bookmark del.icio.us Bookmark @ SIMPIFY Bookmark MISTER WONG Bookmark Linkarena Bookmark icio.de Bookmark oneview Bookmark folkd.com Bookmark yigg.de Bookmark reddit Bookmark StumbleUpon Bookmark Slashdot Bookmark blinklist Bookmark technorati add to blogmarks add to blinkbits add to ma.gnolia add to smarking.com add to netvouz add to co.mments add to Connotea add to de.lirio.us

 

Related PDF Files

Unix Shell Scripts


Topic: Shell Programming

that file is called shell script language. Like other programming languages it has variables and flow control. statements (e.g. ifthenelse while for ...

Unix POSIX Shell Programming - SVR4


Topic: Shell Programming

Perform string manipulation and integer arithmetic on shell variables Unix POSIX Shell Programming - SVR4

UNIX (Linux) Shell Script (sh, ksh &bash) Beginners Guide


Topic: Shell Programming

Basic Programming 10. Shell Variables 11. Shell Arithmetic 12. Editing with vi 13. Using the at facility 14. Scheduling 15. Branching 16. Loops 17. Programming with awk(1) Course Content: 1 INTRODUCTION TO THE ...

UNIX System Programming


Topic: Shell Programming

UNIX System Programming Lecture 4 BASH Shell Programming BLP: Chapter 2 BABS Outline: Redirection ... zsh, ksh Change your default shell to bash $ chsh -s /bin/bash 2 Our First Shell Script A ...

SHELL PROGRAMMING


Topic: Shell Programming

SHELL PROGRAMMING (G610) Course Description This course is designed for system administrators ... the different command types on the system • Write a basic batch-file shell script ...

 

Sponsored Links