What is Shell programming and Cygwin?
Shell programming enables using Unix commands to do actions like sorting, editing, re-arranging, formatting and merging files. The commands are grouped together to form miniature applications.
Cygwin is an open-source tool set that helps in compiling and running Unix or Linux applications on Windows platform. It provides for native integration of Windows-based applications, data and other system resources with applications, software tools and data of Unix-like environment.
About Shell Programming with Cygwin Course
The course is intended to provide an understanding of Linux Shell programming, write Shell programs and learn programs related with searching and sorting. Understand the tools available on Cygwin to compile and run Unix or Linux applications on Windows. The course consists of 18 lectures with three hours of HD Video.
Introduction to commands in Shell Programming:
The section begins with the commands commonly used in Shell programming-Read/Print a PDF file, cat- send file to screen in one go, used for piping to other programs, cc- compile a C program, Cd –Change directory, CP- Copy Files, Date-Show current date, dvips- convert a dvi file to Postscript, emacs- ubiquitous text editor, file- describes what type of file, firefox- start Mozilla fire fox, gedit- Gnome text editor, f77/f90- compile a Fortrain 77/99 program. Latex- convert a text file to dvi, logout- closes current shell, rmdr- delete a director, setenv- set an environment variable in tcsh, rm- delete remove files, pwd- show current working directory, renice- renice a running process, ps-list processes on system, quota-shows how much disk space is left, mv- move file, nano-very simple text editor, more- show a file one screen at a time, man- get instructions for a particular Unix command or a bit of Unix.
-Variables-variable refers to a character string which is assigned a value- number, text, filename, device, , any other type of data.- create, assign, delete variables- using Shell. Variable names- letters a to z, A to Z, numbers (0 to 9), underscore character (_). Variables- scalar variables- holds only one value at a time. Accessing values-prefix name with dollar sign ($). Read-only variables- read only command, value cannot be changed. Unsetting variables- to remove variable from list of variables that it tracks.
Variable types –local variables, environment variables,shell variables.
– Program to perform all arithmetic operations- arithmetic operators- addition +, subtraction -, * multiplication, division / divides left hand operand by right hand operand, % modulus- divides left hand operand by right hand operand and returns remainder. Assignment- assign right operand in left operand. Equality- compares two numbers – returns true when both are same. Not equality- compares two numbers- returns true when both are different.
All conditional expressions put in side square braces with one spaces around them. For eg. [ $a==$b].
-How to display output on screen- writing Shell script to display output on screen-ECHO, PRINT Commands. Echo – all the parameters are printed to screen. Eg. echo “EduCBA!”. Add echo command to Shell script. Printf command- printf “ EduCBA\n. –n, format that controls the output as in C printf. \n tuse to print new line. Preserving white spacing or blank spacing.
Shell Programming Procedure:
Functions are used to break down overall functionality of a script into logical subsections- which undertake individual task. Functions are used to do repetitive task-help in reusing code. Similar to procedures, sub routines . Naming functions- function_name- followed by parenthesis, followed by list of commands enclosed in braces. Pass parameters- $1, 2, $3 etc. Using return command- terminate execution of function. Nested function- call the function and other functions. Function that call itself is recursive function. Function call from prompt.
-Syntax- Shell programming grammar. Man pages – help user with Syntax. Man pages- NAME, SYNOPSIS, DESCRIPTION, OPTIONS, SEE ALSO, BUGS, EXAMPLES, AUTHORS.
-Useful Shell Commands- most important shell commands- regular expressesions- ed, sed, awk, grep, vi. Sed- stream editor. Regular expression- string that can be used to describe several sequences of characters. Sed-pattern- regular expression, action- commands, deleting all lines with sed. Sed addresses- particular locations in a file or a range where a particular editing command should be applied. Sed Address Ranges, Substitution command- denoted by s, to substitute any string specified with any other, book ending two strings with forward slash.
-Program to compare three numbers in Shell- use echo, read, if, then, else statements.
-Program to compare three numbers continued.
Execution of Shell Program:
-Read the name from keyboard-Use Read command to read from keyboard or file. Pass the –u option to read command- from file descriptor instead of keyboard from the file descriptor. Syntax-while loop to read the entire file line. Creating shell script called rewritefd. Save & Close. Shell Script to read file line by line- readfile.sh:, proc file system.
Commands used in Shell Program-
create directories, handle files. Cat- display file contents, cd-change directory to dirname, chgrp- change file group, chmod-changing permissions, cp-copy source file into destination, file- determine file type, find –find files, grep-search files for regular expressions, head-display first few lines of a file, in-create softlink on oldname IS-display information about file type, mkdir- create a new directory name, more-display data in paginated form, mv- move or rename, pwd-print currency working directly, rm- remove, delete filename, rmdr – delete existing filename, tail- print last fe lines, touch-update access.
-Manipulating data-awk- pattern scanning, processing language, cmp- compare contents of two files, comm-compare sorted data,cut- cut out selected fields of each line or a file, diff- differential file comparator, expand- expand tabs to spaces.. File compression to save space-zdiff, zmore, zcmp, zcat, uncompressed, gzip, gunzip, . How to get information with Shell commands—apropos, info, man, whatis ,yelp.
-How to display user and terminal type– specifies how your computer connected to host computer exchange information- setting terminal type to ensure both computer communicates in same way. Common terminal type- Digital Equipment Corporation (DEC) VT 100 terminal, setting terminal manually.
Implementation of Shell Program-
Is command lists all files in the directory that match the name. If name is left blank,it will list all files in directory. Is option for display- -a- display all files, -b display nonprinting characters in octal, -c displays files in a file timestamp, -C displays files in a columnar format (default), -d displays only directories, -f interprets each name as a directory, not a file, -F Flags filenames, -g displays the long format listing, but exclude owner name, -I displays inode for each file, l displays long format listing, -L displays file or directory referenced by a symbolic link, -m displays names as a comma-separated list, -n displays the long format listing, with GID, UID numbers, -O displays the long format listing, excludes group name, -p displays directories with /, displays all non-printing characters as ?, -r displays files in reverse order. –R displays sub directories as well,-t displays newest files first (on timestamp), -u displays files by the file access time, -X displays file as rows, -1 displays each entry on a line.
-For loop- list of items- repeats set of commands for every item on list- var – name of variable, word1 to WordN- sequences of characters separated by words. Each time loop is executive, the value of variable var is set to next word from the list.
-Shell Loop types-The While Loop, The For loop, The Until loop, the select loop- use loop based on situation. Nesting loops – use loop as a part of the body of another while loop. Loop Nesting. The Break statement, the Continue Statement. Infinite Loop- the loop may continue forever if condition not met. Executes for ever- without terminating. Break Statement- terminates execution of the entire loop- after completing the execution of all the lines of code up to the break. Continue statement- used when an error occurs- executive in next iteration of the loop. Using integer arguments to continue commandto skip commands from nested loops.
-Implementation, Execution of Shell Programming- Execute Shell script using File Name, Execute by specifying interpreter, execute using ../ (dot space dot dash) and execute Shell using Source Command. Shell- csh or tcsh- sentenv, TERM vt100, sh- TERM=vt100, export TERM=vt100. Setting type permanently- Shell –csh- .cshrc, .login, tcsh-.cshrc, ksh-.profile, zsh- .zshrc, bash-.bash_profile.
Requirements for Shell Programming on Cygwin Course
Why learn Shell Programming on Cygwin?
Shell programming Is quick and easy method and adheres to the class UNIX philosophy of breaking complex projects into simple sub tasks, of chaining together components and utilities. It helps learners understand the basis of Linux Shell programming, write shell programs and save time with automated scripts.
Frequently Asked Questions (FAQ’s)
- Is Shell programming superior to fourth generation languages? Shell programming is not comparable to fourth generation languages as each has its advantages but Shell’s feature of breaking complex tasks into simpler subtasks makes it aesthetically appealing.
- Is the course certified by industry body or university? No this course is designed by EduCBA and has no affiliation to an industry body or university.
- Does this program require advanced hardware or programming skills? Basic computer knowledge, Linux commands and programming logic would help but no advanced programming skills or hardware skills are required.
- Is the course practical oriented or theory oriented? The course is both practical and theory oriented as all important concepts in Shell programming are covered while enabling learner to write Shell programs on his own.
- What are the career prospects for Shell Programming? There are a large number of opportunities for Unix Administrators, Team Leads, Data center heads, Informatica Developers, Teradata developers, application developers, senior software engineers, Java developers, who are knowledgeable in Unix Shell Programming, Shell scripting.
- How is the course delivered to learners? The mode of delivery is online – through lectures and high quality video.
- Is installation of new software, hardware necessary for this course? No, Cygwin is an open source software and doesn’t require investment for license.
Learning is such a great experience with EduCBA. It takes away the strain and pressures associated with learning a new topic. I was really impressed by the Shell Programming course with Cygwin. All the commands, programming procedures, logic ,compiling and implementation have been dealt with in a lucid manner. Shell Programming has some unique strengths compared to fourth generation programming languages and I am glad I could understand them in perspective. The lessons were clear and lucid, videos were of good quality.I am happy to recommend EduCBA courses to professionals and students.
EduCBA has proven that online learning can be meaningful, help in acquiring new skills and knowledge irrespective of our age. The Shell Programming on Cygwin covers all major topics related to shell programming.The lectures were awesome- even beginners can understand the concepts and learn the syntax and write code. Using UNIX functionality in Windows makes Shell programming really worthwhile. I’v e already started using the skills learnt in Shell Programming in my job and it gives immense satisfaction. Thanks once again to EduCBA. I am glad to refer some of my friends and colleagues interested in Shell Programming and related courses.
Sushil Kumar Bharpure:
Education is a continuing process that starts from childbirth till the grave. But until the advent of e-learning it was difficult for those in industry to upgrade their skills or acquire new ones. I have seen many of my friends who haven’t done any new learning after getting a job or starting a business. I am thankful to EduCBA for bringing a variety of courses at affordable range with good quality video and lectures. I was impressed by the Shell Programming on Cygwin as it explains difficult concepts, commands and procedures in a simple way. It is good for both beginners and professionals. In some respects it is superior to fourth generation languages and I am happy to have mastered the skill. Understanding the theory, learning to write programs and understanding its logic is important from a programmer’s point of view. Shell Programming is quite comprehensive and I am glad to recommend this course to any one interested in this program.
|Where do our learners come from?|
|Professionals from around the world have benefited from eduCBA’s Shell Porgramming on Cygwin courses. Some of the top places that our learners come from include New York, Dubai, San Francisco, Bay Area, New Jersey, Houston, Seattle, Toronto, London, Berlin, UAE, Chicago, UK, Hong Kong, Singapore, Australia, New Zealand, India, Bangalore, New Delhi, Mumbai, Pune, Kolkata, Hyderabad and Gurgaon among many.|