This document provides an overview of shell scripting. It discusses that shell is the interface between the user and the operating system. Bash is the default shell for Linux systems. Shell scripts allow system administration tasks to be automated without writing full programs. The document outlines shell script syntax including variables, conditions, loops, functions, and commands. It provides examples of how to write shell scripts using these basic elements.
Best training-in-mumbai-shell scriptingvibrantuser
Vibrant Technologies is headquarted in Mumbai,India.We are the best Shell Scripting training provider in Navi Mumbai who provides Live Projects to students.We provide Corporate Training also.We are Best Shell Scripting classes in Mumbai according to our students and corporators
The document discusses shell scripting and provides examples of common shell scripting concepts and commands. It covers topics such as variables, conditionals, loops, functions, command execution, pipes, redirection, and here documents. Examples are provided to demonstrate how to write shell scripts using these different concepts and commands like echo, expr, case, if/else, for/while loops, functions, and more. The goal is to explain the basics of shell scripting through examples and outlines.
The Raspberry Pi is a series of credit card–sized single-board computers developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools.
The original Raspberry Pi and Raspberry Pi 2 are manufactured in several board configurations through licensed manufacturing agreements with Newark element14 (Premier Farnell), RS Components and Egoman. These companies sell the Raspberry Pi online. Egoman produces a version for distribution solely in China and Taiwan, which can be distinguished from other Pis by their red colouring and lack of FCC/CE marks. The hardware is the same across all manufacturers.
The original Raspberry Pi is based on the Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZF-S 700 MHz processor, VideoCore IV GPU, and was originally shipped with 256 megabytes of RAM, later upgraded (models B and B+) to 512 MB. The system has Secure Digital (SD) (models A and B) or MicroSD (models A+ and B+) sockets for boot media and persistent storage.
This document provides a summary of Perl's modern features and history from versions 1 through 5.26. It describes key additions and changes over time such as lexical filehandles in 5.6, three argument open in 5.8, and major new features introduced in 5.10 like say and state. It emphasizes that Perl development is ongoing with thousands of bug fixes and improvements made in each release beyond the new features highlighted.
This document provides an overview of Linux Bash shell scripting. It covers topics such as writing basic scripts, using variables and arithmetic, conditional statements, loops, reading/writing files, and more. Examples are given for many common scripting tasks like renaming files, checking disk space, searching files, generating random numbers, and calculating values. The document is intended to teach the basics of shell scripting through explanations and code samples.
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Zyxware Technologies
A workshop on "An introduction to BASH shell scripting". Conducted at CSI Students Convention at TKM College of Engineering, Kollam, Kerala on 15th September, 2012
http://www.zyxware.com/articles/3080/zyxware-conducts-workshop-on-bash-scripting-at-tkm-college-of-engineering-kollam
Best training-in-mumbai-shell scriptingvibrantuser
Vibrant Technologies is headquarted in Mumbai,India.We are the best Shell Scripting training provider in Navi Mumbai who provides Live Projects to students.We provide Corporate Training also.We are Best Shell Scripting classes in Mumbai according to our students and corporators
The document discusses shell scripting and provides examples of common shell scripting concepts and commands. It covers topics such as variables, conditionals, loops, functions, command execution, pipes, redirection, and here documents. Examples are provided to demonstrate how to write shell scripts using these different concepts and commands like echo, expr, case, if/else, for/while loops, functions, and more. The goal is to explain the basics of shell scripting through examples and outlines.
The Raspberry Pi is a series of credit card–sized single-board computers developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools.
The original Raspberry Pi and Raspberry Pi 2 are manufactured in several board configurations through licensed manufacturing agreements with Newark element14 (Premier Farnell), RS Components and Egoman. These companies sell the Raspberry Pi online. Egoman produces a version for distribution solely in China and Taiwan, which can be distinguished from other Pis by their red colouring and lack of FCC/CE marks. The hardware is the same across all manufacturers.
The original Raspberry Pi is based on the Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZF-S 700 MHz processor, VideoCore IV GPU, and was originally shipped with 256 megabytes of RAM, later upgraded (models B and B+) to 512 MB. The system has Secure Digital (SD) (models A and B) or MicroSD (models A+ and B+) sockets for boot media and persistent storage.
This document provides a summary of Perl's modern features and history from versions 1 through 5.26. It describes key additions and changes over time such as lexical filehandles in 5.6, three argument open in 5.8, and major new features introduced in 5.10 like say and state. It emphasizes that Perl development is ongoing with thousands of bug fixes and improvements made in each release beyond the new features highlighted.
This document provides an overview of Linux Bash shell scripting. It covers topics such as writing basic scripts, using variables and arithmetic, conditional statements, loops, reading/writing files, and more. Examples are given for many common scripting tasks like renaming files, checking disk space, searching files, generating random numbers, and calculating values. The document is intended to teach the basics of shell scripting through explanations and code samples.
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...Zyxware Technologies
A workshop on "An introduction to BASH shell scripting". Conducted at CSI Students Convention at TKM College of Engineering, Kollam, Kerala on 15th September, 2012
http://www.zyxware.com/articles/3080/zyxware-conducts-workshop-on-bash-scripting-at-tkm-college-of-engineering-kollam
Unix 1st sem lab programs a - VTU KarnatakaiCreateWorld
This document contains code for several shell scripting exercises:
1. Lab1a accepts command line arguments and prints them in reverse order.
2. Lab1b checks if two file permissions are identical, printing the common permission or each file's individual permissions.
3. Lab2b creates all directories in a path if they don't exist.
4. Lab9b counts and reports the occurrences of words from the first argument file that are present in other argument files.
This document discusses scripting in Linux. It covers creating and running scripts, basic script architecture including shebang lines and variables, commands like echo, read, and conditional and loop structures. Examples provided include a login validation script, calculator script, and modified calculator with division error handling, and concept of a phonebook script.
This presentation is made for beginners who wish to write a simple script and also help those who already working in the sys-admin, support roles to increase their scope for more experiments in different areas where a developer, sys-admin, app-admin, web-admin can use it.
This talk describes refactoring FindBin::libs from Perl5 to Raku: breaking the module up into functional pieces, writing the tests using Raku, testing and releasing the module with mi6.
This document discusses the history and features of recent Perl releases. It describes changes such as new features like smart matching, performance enhancements, deprecated functionality and removals, updated modules, documentation improvements, and bug fixes between Perl 5.8 through 5.20. Key details include added features like given/when blocks, improvements to regular expressions, addition of new modules, and transition from Perforce to Git for version control.
The document provides an introduction to shell scripting basics in UNIX/Linux systems. It discusses what a shell and shell script are, introduces common shells like bash, and covers basic shell scripting concepts like running commands, variables, conditionals, loops, and calling external programs. Examples are provided for many common shell scripting tasks like file manipulation, text processing, scheduling jobs, and more.
The document discusses various Unix/Linux commands for text processing and file management. It describes the commands head, tail, tr, sort, cut, uniq, diff, tee, find, and grep. Head displays the first few lines of a file, tail displays the last few lines, and tr translates or deletes characters. Sort sorts the lines of a text file, cut removes sections from each line, and uniq removes duplicate lines from a sorted file. Diff finds differences between two files.
Embed perl allows a C program to use Perl code and features by adding a Perl interpreter to the C program. It allows calling Perl subroutines from C, evaluating Perl statements, and performing Perl regular expressions. Using embed perl provides access to CPAN modules and Perl's powerful regex engine without needing PCRE. The basic steps are to initialize an interpreter, parse Perl code, run the code, and destruct the interpreter. Output can be captured by overriding Perl's filehandle layers to write to C variables instead of files. Embed perl is not difficult and provides a way to leverage Perl in C and C++ programs.
This document provides an overview of some new features and enhancements in Ruby 2.0, including refinements, Module#prepend, keyword arguments, lazy enumerables, %i and %I symbol literals, default UTF-8 encoding, Struct#to_h, respond_to? limitations for protected methods, and require optimizations.
The document discusses Modern Perl and how the language has evolved over time. Some key changes include new features like say() in Perl 5.10, improved object orientation with Moose, and improved error handling with modules like autodie. Modern Perl development focuses on stability while still innovating and uses CPAN to share thousands of open source modules.
The document provides an overview of the Unix shell and its basic concepts:
- The shell allows users to interact with the operating system by entering commands
- Common Unix shells include bash, csh, and ksh
- The shell prompt displays information about the user and current directory
- Commands can be run internally by the shell or externally by spawning new processes
- Processes have attributes like the command line, exit status, and environment variables
The document discusses processing large sequence data files in parallel using Raku. It describes reading input sequences from files in fixed-size chunks, passing the chunks to worker threads for processing, and using techniques like gather/take and lazy evaluation to improve performance over alternative approaches. The key steps are:
1. Read the input file in chunks and pass chunks to worker threads for parallel processing.
2. Use gather/take and lazy evaluation to improve throughput over alternatives like forking processes or using channels that introduce overhead.
3. SHA sequences in parallel to detect duplicates while avoiding memory issues from comparing all pairs directly.
The document provides an introduction to shell scripting. It discusses that shell scripts are scripting languages similar to C that allow for control structures like loops and conditionals, functions, and variables. It provides examples of how to write for loops, while loops, if/else statements, functions, and how to use variables and environment variables in shell scripts. It also covers executing shell scripts and using commands like test, expr, and case.
Face it, backticks are a pain. BASH $() construct provides a simpler, more effective approach. This talk uses examples from automating git branches and command line processing with getopt(1) to show how $() works in shell scripts.
There are a lot of operators in Perl 6, so many that it can be called an OOL: operator oriented language. Here I describe most of them from the angle of contexts, which Perl 6 has also much more than Perl 5.
I, For One, Welcome Our New Perl6 Overlordsheumann
The document discusses Perl 6 modules and features including variables, binding, classes, attributes, caller, and more. Code examples are provided to demonstrate how to use various Perl 6 constructs like binding variables, defining classes, accessing caller information, and using attributes. Modules like Perl6::Variables, Perl6::Binding, Perl6::Classes are also imported and used.
The document provides 22 shell programming examples covering tasks like checking if a number is even or odd, finding leap years, calculating area and circumference of a circle, checking if a number is a palindrome, finding sum of odd and even numbers in a set, calculating roots of a quadratic equation, checking if a number is Armstrong or prime, generating prime numbers between 1-50, finding sum of squares or cubes of digits of a number, executing UNIX commands using case statements, counting vowels in text, displaying student grades, finding smallest or second highest number, finding single digit sum of a number, and finding sum of odd and even digits from a number.
This document provides an overview of the Python programming language, including its history, key features, syntax examples, and common uses. It also discusses how Python can be used under Linux and some potential issues.
The document provides an introduction to UNIX shell scripting basics including what a shell and shell script are, how to run commands and write simple shell scripts using bash, and some applied shell programming concepts like variables, conditionals, loops, redirection and pipes. It covers common shells like bash, directories like /bin, writing and running simple scripts, and techniques for running programs, passing arguments, scheduling jobs and more.
(How) Does VA Smalltalk fit into today's IT landscapes?Joachim Tuchel
This talk gives a brief overview of today's most imprtant IT Trends, from rich client and rich internet applications to Web Services. Joachim Tuchel shows how VA Smalltalk and it's existing and upcoming features help developers integrate new and existing VA Smalltalk applications into these architectures.
This presentation was given by Joachim Tuchel at the VA Smalltalk Forum Europe 2008 in Frankfurt am Main.
Unix 1st sem lab programs a - VTU KarnatakaiCreateWorld
This document contains code for several shell scripting exercises:
1. Lab1a accepts command line arguments and prints them in reverse order.
2. Lab1b checks if two file permissions are identical, printing the common permission or each file's individual permissions.
3. Lab2b creates all directories in a path if they don't exist.
4. Lab9b counts and reports the occurrences of words from the first argument file that are present in other argument files.
This document discusses scripting in Linux. It covers creating and running scripts, basic script architecture including shebang lines and variables, commands like echo, read, and conditional and loop structures. Examples provided include a login validation script, calculator script, and modified calculator with division error handling, and concept of a phonebook script.
This presentation is made for beginners who wish to write a simple script and also help those who already working in the sys-admin, support roles to increase their scope for more experiments in different areas where a developer, sys-admin, app-admin, web-admin can use it.
This talk describes refactoring FindBin::libs from Perl5 to Raku: breaking the module up into functional pieces, writing the tests using Raku, testing and releasing the module with mi6.
This document discusses the history and features of recent Perl releases. It describes changes such as new features like smart matching, performance enhancements, deprecated functionality and removals, updated modules, documentation improvements, and bug fixes between Perl 5.8 through 5.20. Key details include added features like given/when blocks, improvements to regular expressions, addition of new modules, and transition from Perforce to Git for version control.
The document provides an introduction to shell scripting basics in UNIX/Linux systems. It discusses what a shell and shell script are, introduces common shells like bash, and covers basic shell scripting concepts like running commands, variables, conditionals, loops, and calling external programs. Examples are provided for many common shell scripting tasks like file manipulation, text processing, scheduling jobs, and more.
The document discusses various Unix/Linux commands for text processing and file management. It describes the commands head, tail, tr, sort, cut, uniq, diff, tee, find, and grep. Head displays the first few lines of a file, tail displays the last few lines, and tr translates or deletes characters. Sort sorts the lines of a text file, cut removes sections from each line, and uniq removes duplicate lines from a sorted file. Diff finds differences between two files.
Embed perl allows a C program to use Perl code and features by adding a Perl interpreter to the C program. It allows calling Perl subroutines from C, evaluating Perl statements, and performing Perl regular expressions. Using embed perl provides access to CPAN modules and Perl's powerful regex engine without needing PCRE. The basic steps are to initialize an interpreter, parse Perl code, run the code, and destruct the interpreter. Output can be captured by overriding Perl's filehandle layers to write to C variables instead of files. Embed perl is not difficult and provides a way to leverage Perl in C and C++ programs.
This document provides an overview of some new features and enhancements in Ruby 2.0, including refinements, Module#prepend, keyword arguments, lazy enumerables, %i and %I symbol literals, default UTF-8 encoding, Struct#to_h, respond_to? limitations for protected methods, and require optimizations.
The document discusses Modern Perl and how the language has evolved over time. Some key changes include new features like say() in Perl 5.10, improved object orientation with Moose, and improved error handling with modules like autodie. Modern Perl development focuses on stability while still innovating and uses CPAN to share thousands of open source modules.
The document provides an overview of the Unix shell and its basic concepts:
- The shell allows users to interact with the operating system by entering commands
- Common Unix shells include bash, csh, and ksh
- The shell prompt displays information about the user and current directory
- Commands can be run internally by the shell or externally by spawning new processes
- Processes have attributes like the command line, exit status, and environment variables
The document discusses processing large sequence data files in parallel using Raku. It describes reading input sequences from files in fixed-size chunks, passing the chunks to worker threads for processing, and using techniques like gather/take and lazy evaluation to improve performance over alternative approaches. The key steps are:
1. Read the input file in chunks and pass chunks to worker threads for parallel processing.
2. Use gather/take and lazy evaluation to improve throughput over alternatives like forking processes or using channels that introduce overhead.
3. SHA sequences in parallel to detect duplicates while avoiding memory issues from comparing all pairs directly.
The document provides an introduction to shell scripting. It discusses that shell scripts are scripting languages similar to C that allow for control structures like loops and conditionals, functions, and variables. It provides examples of how to write for loops, while loops, if/else statements, functions, and how to use variables and environment variables in shell scripts. It also covers executing shell scripts and using commands like test, expr, and case.
Face it, backticks are a pain. BASH $() construct provides a simpler, more effective approach. This talk uses examples from automating git branches and command line processing with getopt(1) to show how $() works in shell scripts.
There are a lot of operators in Perl 6, so many that it can be called an OOL: operator oriented language. Here I describe most of them from the angle of contexts, which Perl 6 has also much more than Perl 5.
I, For One, Welcome Our New Perl6 Overlordsheumann
The document discusses Perl 6 modules and features including variables, binding, classes, attributes, caller, and more. Code examples are provided to demonstrate how to use various Perl 6 constructs like binding variables, defining classes, accessing caller information, and using attributes. Modules like Perl6::Variables, Perl6::Binding, Perl6::Classes are also imported and used.
The document provides 22 shell programming examples covering tasks like checking if a number is even or odd, finding leap years, calculating area and circumference of a circle, checking if a number is a palindrome, finding sum of odd and even numbers in a set, calculating roots of a quadratic equation, checking if a number is Armstrong or prime, generating prime numbers between 1-50, finding sum of squares or cubes of digits of a number, executing UNIX commands using case statements, counting vowels in text, displaying student grades, finding smallest or second highest number, finding single digit sum of a number, and finding sum of odd and even digits from a number.
This document provides an overview of the Python programming language, including its history, key features, syntax examples, and common uses. It also discusses how Python can be used under Linux and some potential issues.
The document provides an introduction to UNIX shell scripting basics including what a shell and shell script are, how to run commands and write simple shell scripts using bash, and some applied shell programming concepts like variables, conditionals, loops, redirection and pipes. It covers common shells like bash, directories like /bin, writing and running simple scripts, and techniques for running programs, passing arguments, scheduling jobs and more.
(How) Does VA Smalltalk fit into today's IT landscapes?Joachim Tuchel
This talk gives a brief overview of today's most imprtant IT Trends, from rich client and rich internet applications to Web Services. Joachim Tuchel shows how VA Smalltalk and it's existing and upcoming features help developers integrate new and existing VA Smalltalk applications into these architectures.
This presentation was given by Joachim Tuchel at the VA Smalltalk Forum Europe 2008 in Frankfurt am Main.
Pascal's triangle is a triangular array of the binomial coefficients where each number is the sum of the two numbers directly above it. In 1900, Professor David Hilbert delivered a lecture before the International Congress of Mathematicians where he discussed mathematical problems and mentioned Pascal's triangle as an example.
Presents how TachVault's fair value options prices can be instantly accessed from Web/Mobile devices or from Excel/VBA financial applications as shown in http://www.tachvault.com/downloadFilesAction.php?fileName=Option-Pricing.xlsm.
London Station provides advanced algebra tutoring services in Riverside. The company works with students to help strengthen their algebra skills and prepare for standardized tests through individualized tutoring sessions and comprehensive study plans. London Station tutors take the time to understand each student's needs and tailor their instruction accordingly.
Pascal Metrics - Current Use Of Technology In Automating Patient Harm Identif...William Andrews
Patient safety leaders agree that understanding the full extent and patterns of patient harm is important, but hospitals currently lack tools to comprehensively measure harm. A survey found that while harm is commonly discussed, these discussions are likely informed by limited voluntary reporting that detects only a small fraction of actual harm. Nearly all respondents agreed that technology providing real-time data on harm patterns would be valuable. The document proposes that automated systems using electronic medical record data in patient safety organizations could reliably detect harms, allowing hospitals to learn from this information to improve care delivery and reduce costs.
RABL is a Ruby gem that generates JSON, XML, and other data formats from Ruby objects for use in APIs. It allows developers to customize how objects are represented, including renaming attributes, nesting related objects, and only including certain fields conditionally. RABL uses a template format to define the structure and attributes of the serialized objects. Templates can also inherit from and extend each other to reduce duplication and support different representations of the same data.
The document provides information about HB Education and Consulting Services, including their contact details and a list of 76 papers published between January 2015 to November 2015 across various topics including cloud computing, data mining, dependable and secure computing, information forensics and security, parallel and distributed systems, sensors, services computing, signal processing letters, systems, vehicular technology, wireless communications, audio, speech, and language processing, communications, consumer electronics, image processing, internet, mobile computing, multimedia, networking, selected topics in signal processing, and neural networks and learning systems.
A quick introduction to the object-oriented programming language Smalltalk, part of a full lecture on Programming Paradigms at UCL university in Belgium, focussing on the programming languages Smalltalk, Ruby and Java, with reflection and meta programming as underlying theme.
PHYSICAL COMPUTING WITH RGB LED OR MATRIX
Today we enter a topic in programming called
embedded computing with the internet; we code a
RGB LED light on a Arduino board with a breadboard
on which we switch off or on the light by a browser
on an android device with our own web server and
their COM or socket protocols too.
This prentation describes quality in the context of commonly understood (but under-appreciated) Unix programming best practices in three general categories.
Transparency: The ease with which a script can be understood by reading the code
Clear communication: How well the script informs the user of its activities
Scalability: Whether the script can be used across the enterprise without intervention
This document provides an overview of the Pharo open-source Smalltalk project. It begins with a brief introduction to Smalltalk syntax, object model, and key concepts like message passing and dynamic binding. It then discusses Pharo itself, describing it as a pure object-oriented programming language and integrated development environment based on Smalltalk. The document demonstrates some Pharo tools and features like the class browser and polymorph user interface support. It highlights Pharo's open development process and encourages community involvement through activities like reporting bugs, writing tests, and contributing code.
This document summarizes the work of the FruitBreedomics project WP2 on developing apple and peach pre-breeding material. For apples, the objectives were to introduce resistance to scab, mildew and fire blight through marker-assisted breeding in Switzerland and Germany. Selected progenies combined multiple resistance genes. For peaches, the focus was on resistance to powdery mildew and brown rot through conventional breeding in Italy, with some progenies combining both resistances. Marker-assisted breeding in France targeted resistance to multiple pests and diseases. The availability of pre-breeding material from different populations was also outlined.
This document summarizes pilot studies on peach conducted for the FruitBreedomics project. The objective was to verify the efficiency of MAS selection by screening 1500 trees from public and private partners for quality and resistance traits using SNP markers. Traits like flesh color, shape, acidity level, and resistance to aphids and powdery mildew were studied. Genotyping was performed using KASP technology. Results showed good prediction efficiency for resistance to green peach aphid and several quality traits, demonstrating the effectiveness of MAS. Further analysis of data and development of additional markers is needed to finalize the approach.
Este documento proporciona información sobre el SQL Saturday #448 que se llevó a cabo en Bogotá, Colombia el 12 de septiembre de 2015. Incluye detalles sobre los organizadores del capítulo, patrocinadores y una sesión sobre las novedades de SQL Server 2016 presentada por Eduardo Castro. También contiene enlaces a evaluaciones y material de referencia sobre las nuevas características de SQL Server 2016.
In this talk, I will discuss the extensions we have made to our approach to semantic image segmentation. I will show how the results of object detectors and spatial priors can be naturally integrated into our hierarchical conditional random field (HCRF) approach based on the harmony potential. The addition of these extra cues, as well as class-specific normalization of classifier outputs, significantly improves segmentation quality.
Building Seaside Applications in VA SmalltalkJoachim Tuchel
Short intro to Seaside Web Programming in Smalltalk.
Thoughts and experiences on turning existing Smalltalk applications into a Web Application Server using Seaside. Seaside makes Web programming very much like writing a modal fat/rich client application.
This presentation was given at the VA Smalltalk Forum Europe 2008.
For more information visit http://www.objektfabrik.de
This document provides an overview of the Google Display Network (GDN) and how advertisers can use it to reach customers. Some key points:
- The GDN is Google's digital advertising network that allows ads to be placed on Google sites as well as partner sites, reaching a large audience.
- Advertisers can use different targeting options like contextual targeting, placement targeting, and remarketing to engage with customers based on things like the content they're viewing, specific sites, or past website visits.
- The document outlines the various formats, tools, and features available to advertisers for planning, optimizing, and measuring campaigns on the GDN.
assignment riordan manufacturing process improvement final cnathan124
The document discusses process improvement efforts at Riordan Manufacturing for producing electric fans. It outlines the current Define-Measure-Analyze-Improve-Control (DMAIC) process and identifies bottlenecks. Two new processes are designed: make-to-stock fans and custom-made fans. Project plans are created for each new process outlining tasks, roles, deliverables, and timelines. Total quality management tools like focus groups, flow charts, and tree diagrams are identified as helping to improve the process and identify issues. The conclusion emphasizes that the new processes will shorten manufacturing time through constant evaluation and improvement.
The Raspberry Pi is a series of credit card–sized single-board computers developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools.
The original Raspberry Pi and Raspberry Pi 2 are manufactured in several board configurations through licensed manufacturing agreements with Newark element14 (Premier Farnell), RS Components and Egoman. These companies sell the Raspberry Pi online. Egoman produces a version for distribution solely in China and Taiwan, which can be distinguished from other Pis by their red colouring and lack of FCC/CE marks. The hardware is the same across all manufacturers.
The original Raspberry Pi is based on the Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZF-S 700 MHz processor, VideoCore IV GPU, and was originally shipped with 256 megabytes of RAM, later upgraded (models B and B+) to 512 MB. The system has Secure Digital (SD) (models A and B) or MicroSD (models A+ and B+) sockets for boot media and persistent storage.
The document provides an introduction to UNIX shell scripting basics. It discusses what a shell and shell script are, how to run commands and write simple shell scripts using bash. It covers basics like variables, conditionals, loops, pipes and redirection to process inputs, outputs and errors when running programs from shell scripts.
This document provides an introduction and overview of shell scripting in Linux. It discusses what a shell script is, when they should and should not be used, examples of common shell scripts, and an introduction to programming features commonly used in shell scripts such as variables, conditionals, loops, command line arguments, and more. Key points covered include that shell scripts allow automating command execution, are useful for repetitive tasks, and come with programming features to customize behavior.
The document provides information about shells in Linux operating systems. It defines what a kernel and shell are, explains why shells are used, describes different types of shells, and provides examples of shell scripting. The key points are:
- The kernel manages system resources and acts as an intermediary between hardware and software. A shell is a program that takes commands and runs them, providing an interface between the user and operating system.
- Shells are useful for automating tasks, combining commands to create new ones, and adding functionality to the operating system. Common shells include Bash, Bourne, C, Korn, and Tcsh.
- Shell scripts allow storing commands in files to automate tasks.
Shell scripting - By Vu Duy Tu from eXo Platform SEAThuy_Dang
This document provides an overview of shell scripting and how it can be used for eXo Platform applications. It defines what a shell and shell script are, describes common shells like bash and csh, and covers shell script basics like parameters, operators, and control structures. Examples are given of how shell scripts could be used to automate tasks in eXo like building projects, running commands, and checking for bugs. The document also outlines a proposed "EXOCT" shell script for commonly used eXo functions.
This document provides an overview of shell scripting in Bash. It covers basic script syntax including the shebang line and running scripts. It discusses shell variables, control structures like for loops, and commands like echo, read, and printf for console I/O. The document also covers special variables, command line arguments, and provides exercises for students to practice shell scripting concepts.
A set of rules and best practices to write bash shell scripts. Following these rules, you will have less programming errors and spend less time debugging.
It also shows and explains a lot of features from bash you didn't event know existed :
Pattern removal: ${var##*/}
StrReplace: ${var//search/replace}
Options: set -o pipefail -o nounset -o noclobber
And many more...
This document provides an introduction to shell scripting using the bash shell. It covers key concepts such as shell variables, command substitution, quoting, aliases, and initializing files. The shell acts as both a command-line interface and programming language. It executes commands, supports scripting through variables and control structures, and reads initialization files on startup to customize the environment. Well-formed shell scripts allow combining and sequencing commands to perform automated tasks.
This document provides an introduction to shell programming concepts in Bash including conditionals, loops, and color/cursor control. It covers basic syntax for if/else, case, while, for, until loops, and examples of using escape sequences for colors and cursor movement. Code snippets are provided as examples for common tasks like checking conditions, iterating with loops, and manipulating text output.
The document discusses various topics related to Unix including the Unix filesystem, file permissions, advanced commands like sort, grep, and tar, shells, shell programming, and AWK. It also includes the speaker's learnings and availability to answer questions.
Bash is not a second zone citizen programming languageRené Ribaud
Bash is a widely used command line interpreter and scripting language. It is the default shell for most Linux distributions. While Bash scripts are commonly used to perform important system tasks, they are not always written with the same discipline as other programming languages. Adopting practices like Bash strict mode, following style guides, using functions and testing can help make shell scripts more reliable. Productivity tools like Shellcheck, shfmt and Bats can aid in developing robust Bash scripts.
Shell scripts allow users to automate tasks by writing programs made up of shell commands. A shell script is a text file containing shell commands that will be executed sequentially. The #! line at the top specifies the shell interpreter to use, such as sh or bash. Shell scripts can include control structures like if/then conditional statements and for loops to alter the program flow. Variables and command line arguments allow shell scripts to take input and store output. Redirection operators are used to control program input/output.
This document provides an overview of shell scripting in 3 paragraphs or less:
The document discusses creating and executing shell scripts, including using vi or nano to create scripts, setting file permissions, and executing scripts. It also covers various shell scripting concepts like variables, operators, if/case statements, loops (for, while, until), and creating functions. The goal of shell scripts is to automate tasks and save time by wrapping common Linux commands into reusable programs. Learning shell scripting allows you to programmatically control and administer the Linux system.
Unix shell scripts are text files that can be run by an interpreter to perform tasks. They differ from compiled programs in that they do not need to be compiled and can be portable across machines. Shell scripts are useful for lightweight operations like file manipulation, sending emails, and network communication, while compiled programs are better for CPU intensive or critical applications. Common shell commands include head, tail, echo, sort, cat, grep, find, wc, diff, and more.
The document provides an introduction to shell scripting basics in UNIX/Linux. It discusses what a shell and shell script are, introduces the popular bash shell, and covers running commands, variables, logic, and other shell scripting concepts. The key points covered include:
- A shell is a program that takes commands and runs other programs. Popular shells include bash, csh, tcsh, and ksh.
- A shell script is a text file containing shell commands that is executable. Creating and running a simple "Hello world" script is demonstrated.
- Running commands, pipes, redirection, variables, logic, and flow control like if/else, for loops are explained.
- Useful bash
This document provides an introduction to shell programming including:
- An overview of what shell programming is and common uses
- A review of basic UNIX commands used in shell scripts
- Examples of shell scripts demonstrating variables, parameters, conditionals, loops, and command substitution
- Descriptions of useful commands for shell scripts like cut, sed, grep, and more
- Exercises for readers to practice shell scripting skills
PuppetConf 2017: Puppet Tasks: Taming ssh in a "for" loop- Alex Dreyer, PuppetPuppet
Puppet's declarative language is a powerful tool for many configuration management problems. Sometimes it can be a burden to describe complex deploys or ad hoc commands in terms of the desired state of a node. Puppet tasks provide a solution to these problems that integrates these tasks with the rest of your puppet code. This talk will cover how to write simple tasks, How to install and run in PE and FOSS, common patterns for writing more complex reusable tasks, using task metadata to document your task and take full advantage of the task UI, writing tasks for PE RBAC, details of the Puppet Task API, how tasks are executed in PE and with Bolt, and how to write a simple task plan.
The document discusses best practices for writing bash scripts. It covers topics like using shebangs, setting debug options, creating descriptive variables, command substitution, error handling, and profiling code. The document provides examples and tips for each topic. It emphasizes starting scripts with a header, using variables properly, checking for errors, and understanding the overall problem life cycle for writing better bash scripts.
- Variables are used to store and represent data in scripts and programs. There are system, environment, local, and user-defined variables.
- System variables are predefined by the shell and control aspects of shell behavior. Environment variables are available to child processes and programs while local variables are only available within the current shell session.
- User-defined variables are created and named by the user. They are defined using varName=value syntax and can be displayed using echo or printf commands.
This document provides an introduction and overview of the Perl programming language. It discusses what Perl is, its history and origins, its uses for bioinformatics tasks, examples of bioinformatics problems suited to Perl, and includes examples of basic Perl programs and concepts like variables, operators, conditionals and loops.
Similar to Best training-in-mumbai-shell scripting (20)
Dive into the realm of operating systems (OS) with Pravash Chandra Das, a seasoned Digital Forensic Analyst, as your guide. 🚀 This comprehensive presentation illuminates the core concepts, types, and evolution of OS, essential for understanding modern computing landscapes.
Beginning with the foundational definition, Das clarifies the pivotal role of OS as system software orchestrating hardware resources, software applications, and user interactions. Through succinct descriptions, he delineates the diverse types of OS, from single-user, single-task environments like early MS-DOS iterations, to multi-user, multi-tasking systems exemplified by modern Linux distributions.
Crucial components like the kernel and shell are dissected, highlighting their indispensable functions in resource management and user interface interaction. Das elucidates how the kernel acts as the central nervous system, orchestrating process scheduling, memory allocation, and device management. Meanwhile, the shell serves as the gateway for user commands, bridging the gap between human input and machine execution. 💻
The narrative then shifts to a captivating exploration of prominent desktop OSs, Windows, macOS, and Linux. Windows, with its globally ubiquitous presence and user-friendly interface, emerges as a cornerstone in personal computing history. macOS, lauded for its sleek design and seamless integration with Apple's ecosystem, stands as a beacon of stability and creativity. Linux, an open-source marvel, offers unparalleled flexibility and security, revolutionizing the computing landscape. 🖥️
Moving to the realm of mobile devices, Das unravels the dominance of Android and iOS. Android's open-source ethos fosters a vibrant ecosystem of customization and innovation, while iOS boasts a seamless user experience and robust security infrastructure. Meanwhile, discontinued platforms like Symbian and Palm OS evoke nostalgia for their pioneering roles in the smartphone revolution.
The journey concludes with a reflection on the ever-evolving landscape of OS, underscored by the emergence of real-time operating systems (RTOS) and the persistent quest for innovation and efficiency. As technology continues to shape our world, understanding the foundations and evolution of operating systems remains paramount. Join Pravash Chandra Das on this illuminating journey through the heart of computing. 🌟
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Tatiana Kojar
Skybuffer AI, built on the robust SAP Business Technology Platform (SAP BTP), is the latest and most advanced version of our AI development, reaffirming our commitment to delivering top-tier AI solutions. Skybuffer AI harnesses all the innovative capabilities of the SAP BTP in the AI domain, from Conversational AI to cutting-edge Generative AI and Retrieval-Augmented Generation (RAG). It also helps SAP customers safeguard their investments into SAP Conversational AI and ensure a seamless, one-click transition to SAP Business AI.
With Skybuffer AI, various AI models can be integrated into a single communication channel such as Microsoft Teams. This integration empowers business users with insights drawn from SAP backend systems, enterprise documents, and the expansive knowledge of Generative AI. And the best part of it is that it is all managed through our intuitive no-code Action Server interface, requiring no extensive coding knowledge and making the advanced AI accessible to more users.
Main news related to the CCS TSI 2023 (2023/1695)Jakub Marek
An English 🇬🇧 translation of a presentation to the speech I gave about the main changes brought by CCS TSI 2023 at the biggest Czech conference on Communications and signalling systems on Railways, which was held in Clarion Hotel Olomouc from 7th to 9th November 2023 (konferenceszt.cz). Attended by around 500 participants and 200 on-line followers.
The original Czech 🇨🇿 version of the presentation can be found here: https://www.slideshare.net/slideshow/hlavni-novinky-souvisejici-s-ccs-tsi-2023-2023-1695/269688092 .
The videorecording (in Czech) from the presentation is available here: https://youtu.be/WzjJWm4IyPk?si=SImb06tuXGb30BEH .
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
Programming Foundation Models with DSPy - Meetup SlidesZilliz
Prompting language models is hard, while programming language models is easy. In this talk, I will discuss the state-of-the-art framework DSPy for programming foundation models with its powerful optimizers and runtime constraint system.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
Generating privacy-protected synthetic data using Secludy and MilvusZilliz
During this demo, the founders of Secludy will demonstrate how their system utilizes Milvus to store and manipulate embeddings for generating privacy-protected synthetic data. Their approach not only maintains the confidentiality of the original data but also enhances the utility and scalability of LLMs under privacy constraints. Attendees, including machine learning engineers, data scientists, and data managers, will witness first-hand how Secludy's integration with Milvus empowers organizations to harness the power of LLMs securely and efficiently.
A Comprehensive Guide to DeFi Development Services in 2024Intelisync
DeFi represents a paradigm shift in the financial industry. Instead of relying on traditional, centralized institutions like banks, DeFi leverages blockchain technology to create a decentralized network of financial services. This means that financial transactions can occur directly between parties, without intermediaries, using smart contracts on platforms like Ethereum.
In 2024, we are witnessing an explosion of new DeFi projects and protocols, each pushing the boundaries of what’s possible in finance.
In summary, DeFi in 2024 is not just a trend; it’s a revolution that democratizes finance, enhances security and transparency, and fosters continuous innovation. As we proceed through this presentation, we'll explore the various components and services of DeFi in detail, shedding light on how they are transforming the financial landscape.
At Intelisync, we specialize in providing comprehensive DeFi development services tailored to meet the unique needs of our clients. From smart contract development to dApp creation and security audits, we ensure that your DeFi project is built with innovation, security, and scalability in mind. Trust Intelisync to guide you through the intricate landscape of decentralized finance and unlock the full potential of blockchain technology.
Ready to take your DeFi project to the next level? Partner with Intelisync for expert DeFi development services today!
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
Trusted Execution Environment for Decentralized Process MiningLucaBarbaro3
Presentation of the paper "Trusted Execution Environment for Decentralized Process Mining" given during the CAiSE 2024 Conference in Cyprus on June 7, 2024.
Monitoring and Managing Anomaly Detection on OpenShift.pdfTosin Akinosho
Monitoring and Managing Anomaly Detection on OpenShift
Overview
Dive into the world of anomaly detection on edge devices with our comprehensive hands-on tutorial. This SlideShare presentation will guide you through the entire process, from data collection and model training to edge deployment and real-time monitoring. Perfect for those looking to implement robust anomaly detection systems on resource-constrained IoT/edge devices.
Key Topics Covered
1. Introduction to Anomaly Detection
- Understand the fundamentals of anomaly detection and its importance in identifying unusual behavior or failures in systems.
2. Understanding Edge (IoT)
- Learn about edge computing and IoT, and how they enable real-time data processing and decision-making at the source.
3. What is ArgoCD?
- Discover ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes, and its role in deploying applications on edge devices.
4. Deployment Using ArgoCD for Edge Devices
- Step-by-step guide on deploying anomaly detection models on edge devices using ArgoCD.
5. Introduction to Apache Kafka and S3
- Explore Apache Kafka for real-time data streaming and Amazon S3 for scalable storage solutions.
6. Viewing Kafka Messages in the Data Lake
- Learn how to view and analyze Kafka messages stored in a data lake for better insights.
7. What is Prometheus?
- Get to know Prometheus, an open-source monitoring and alerting toolkit, and its application in monitoring edge devices.
8. Monitoring Application Metrics with Prometheus
- Detailed instructions on setting up Prometheus to monitor the performance and health of your anomaly detection system.
9. What is Camel K?
- Introduction to Camel K, a lightweight integration framework built on Apache Camel, designed for Kubernetes.
10. Configuring Camel K Integrations for Data Pipelines
- Learn how to configure Camel K for seamless data pipeline integrations in your anomaly detection workflow.
11. What is a Jupyter Notebook?
- Overview of Jupyter Notebooks, an open-source web application for creating and sharing documents with live code, equations, visualizations, and narrative text.
12. Jupyter Notebooks with Code Examples
- Hands-on examples and code snippets in Jupyter Notebooks to help you implement and test anomaly detection models.
Digital Marketing Trends in 2024 | Guide for Staying AheadWask
https://www.wask.co/ebooks/digital-marketing-trends-in-2024
Feeling lost in the digital marketing whirlwind of 2024? Technology is changing, consumer habits are evolving, and staying ahead of the curve feels like a never-ending pursuit. This e-book is your compass. Dive into actionable insights to handle the complexities of modern marketing. From hyper-personalization to the power of user-generated content, learn how to build long-term relationships with your audience and unlock the secrets to success in the ever-shifting digital landscape.
3. 3
Outline
What is shell?
Basic
Syntax
Lists
Functions
Command Execution
Here Documents
Debug
Regular Expression
Find
www.vibranttechnologies.co.in
4. 4
Why Shell?
The commercial UNIX used Korn Shell
For Linux, the Bash is the default
Why Shell?
For routing jobs, such as system administration, without
writing programs
However, the shell script is not efficient, therefore, can
be used for prototyping the ideas
For example,
% ls –al | more (better format of listing
directory)
% man bash | col –b | lpr (print man page of man)
www.vibranttechnologies.co.in
5. 5
What is Shell?
Shell is the interface between end user
and the Linux system, similar to the
commands in Windows
Bash is installed as in /bin/sh
Check the version
% /bin/sh --version
Kernel
Other
programs
X window
bash
csh
www.vibranttechnologies.co.in
6. 6
Pipe and Redirection
Redirection (< or >)
% ls –l > lsoutput.txt (save output to lsoutput.txt)
% ps >> lsoutput.txt (append to lsoutput.txt)
% more < killout.txt (use killout.txt as parameter to
more)
% kill -l 1234 > killouterr.txt 2 >&1 (redirect to the
same file)
% kill -l 1234 >/dev/null 2 >&1 (ignore std output)
Pipe (|)
Process are executed concurrently
% ps | sort | more
% ps –xo comm | sort | uniq | grep –v sh | more
% cat mydata.txt | sort | uniq | > mydata.txt
(generates an empty file !)
www.vibranttechnologies.co.in
7. 7
Shell as a Language
We can write a script containing many shell commands
Interactive Program:
grep files with POSIX string and print it
% for file in *
> do
> if grep –l POSIX $file
> then
> more $file
fi
done
Posix
There is a file with POSIX in it
‘*’ is wildcard
% more `grep –l POSIX *`
% more $(grep –l POSIX *)
% more –l POSIX * | more
www.vibranttechnologies.co.in
8. 8
Writing a Script
Use text editor to generate the “first” file
#!/bin/sh
# first
# this file looks for the files containing POSIX
# and print it
for file in *
do
if grep –q POSIX $file
then
echo $file
fi
done
exit 0
% /bin/sh first
% chmod +x first
%./first (make sure . is include in PATH
parameter)
exit code, 0 means successful
www.vibranttechnologies.co.in
11. 11
Quoting
Edit a “vartest.sh” file
#!/bin/sh
myvar=“Hi there”
echo $myvar
echo “$myvar”
echo `$myvar`
echo $myvar
echo Enter some text
read myvar
echo ‘$myvar’ now equals $myvar
exit 0
Output
Hi there
Hi there
$myvar
$myvar
Enter some text
Hello world
$myvar now equals Hello world
www.vibranttechnologies.co.in
12. 12
Environment Variables
$HOME home directory
$PATH path
$PS1 第一層提示符號 (normally %)
$PS2 第二層提示符號 (normally >)
$$ process id of the script
$# number of input parameters
$0 name of the script file
$IFS separation character (white
space)
Use ‘env’ to check the valuewww.vibranttechnologies.co.in
13. 13
Parameter
% IFS = ` `
% set foo bar bam
% echo “$@”
foo bar bam
% echo “$*”
foo bar bam
% unset IFS
% echo “$*”
foo bar bam
doesn’t matter IFS
www.vibranttechnologies.co.in
14. 14
Condition
test or ‘ [ ‘
if test –f fred.c
then
...
fi
If [ -f
fred.c ]
then
...
fi
if [ -f fred.c ];then
...
fi
expression1 –eq expression2
expression1 –ne expression2
expression1 –gt expression2
expression1 –ge expression2
expression1 -lt expression2
expression1 –le expression2
!expression
-d file if directory
-e file if exist
-f file if file
-g file if set-group-id
-r file if readable
-s file if size >0
-u file if set-user-id
-w file if writable
-x file if executableString1 = string2
String1 != string 2
-n string (if not empty string)
-z string (if empty string)
need space !
www.vibranttechnologies.co.in
16. 16
Condition Structure
#!/bin/sh
echo “Is it morning? Please answer yes or no”
read timeofday
if [ $timeofday = “yes” ]; then
echo “Good morning”
elif [ $timeofday = “no” ]; then
echo “Good afternoon”
else
echo “Sorry, $timeofday not recongnized. Enter yes or no”
exit 1
fi
exit 0
www.vibranttechnologies.co.in
17. 17
Condition Structure
#!/bin/sh
echo “Is it morning? Please answer yes or no”
read timeofday
if [ “$timeofday” = “yes” ]; then
echo “Good morning”
elif [ $timeofday = “no” ]; then
echo “Good afternoon”
else
echo “Sorry, $timeofday not recongnized. Enter yes or no”
exit 1
fi
exit 0
If input “enter” still returns Good morning
www.vibranttechnologies.co.in
19. 19
Loop Structure
Use wildcard ‘*’
#!/bin/sh
for file in $(ls f*.sh); do
lpr $file
done
exit 0
Print all f*.sh files
www.vibranttechnologies.co.in
20. 20
Loop Structure
Syntax
while condition
do
statement
done
#!/bin/sh
for foo in 1 2 3 4 5 6 7 8 9 10
do
echo “here we go again”
done
exit 0
#!/bin/sh
foo = 1
while [ “$foo” –le 10 ]
do
echo “here we go again”
foo = $foo(($foo+1))
done
exit 0
Syntax
until condition
do
statement
done
Note: condition is
Reverse to while
How to re-write
previous sample?
www.vibranttechnologies.co.in
21. 21
Case Statement
Syntax
case variable in
pattern [ | pattern ] …) statement;;
pattern [ | pattern ] …) statement;;
…
esac
#!/bin/sh
echo “Is it morning? Please answer yes or no”
read timeofday
case “$timeofday” in
yes) echo “Good Morning”;;
y) echo “Good Morning”;;
no) echo “Good Afternoon”;;
n) echo “Good Afternoon”;;
* ) echo “Sorry, answer not recongnized”;;
esac
exit 0
www.vibranttechnologies.co.in
22. 22
Case Statement
A much “cleaner” version
#!/bin/sh
echo “Is it morning? Please answer yes or no”
read timeofday
case “$timeofday” in
yes | y | Yes | YES ) echo “Good Morning”;;
n* | N* ) echo “Good Afternoon”;;
* ) echo “Sorry, answer not recongnized”;;
esac
exit 0
But this has a problem, if we enter ‘never’ which obeys n*
case and prints “Good Afternoon”
www.vibranttechnologies.co.in
23. 23
Case Statement
#!/bin/sh
echo “Is it morning? Please answer yes or no”
read timeofday
case “$timeofday” in
yes | y | Yes | YES )
echo “Good Morning”
echo “Up bright and early this morning”
;;
[nN]*)
echo “Good Afternoon”;;
*)
echo “Sorry, answer not recongnized”
echo “Please answer yes of no”
exit 1
;;
esac
exit 0
www.vibranttechnologies.co.in
24. 24
List
AND (&&)
statement1 && statement2 && statement3 …
#!/bin/sh
touch file_one
rm –f file_two
if [ -f file_one ] && echo “Hello” && [-f file_two] && echo “ there”
then
echo “in if”
else
echo “in else”
fi
exit 0
Output
Hello
in else
Check if file exist if not then create one
Remove a file
www.vibranttechnologies.co.in
25. 25
List
OR (||)
statement1 || statement2 || statement3 …
#!/bin/sh
rm –f file_one
if [ -f file_one ] || echo “Hello” || echo “ there”
then
echo “in if”
else
echo “in else”
fi
exit 0
Output
Hello
in else
www.vibranttechnologies.co.in
26. 26
Statement Block
Use multiple statements in the same place
get_comfirm && {
grep –v “$cdcatnum” $stracks_file > $temp_file
cat $temp_file > $tracks_file
echo
add_record_tracks
}
www.vibranttechnologies.co.in
27. 27
Function
You can define functions for “structured” scripts
function_name() {
statements
}
#!/bin/sh
foo() {
echo “Function foo is executing”
}
echo “script starting”
foo
echo “script ended”
exit 0
Output
script starting
Function foo is executing
Script ended
You need to define a function before using it
The parameters $*,$@,$#,$1,$2 are replaced by local value
if function is called and return to previous after function is finished
www.vibranttechnologies.co.in
28. 28
Function
#!/bin/sh
sample_text=“global variable”
foo() {
local sample_text=“local variable”
echo “Function foo is executing”
echo $sample_text
}
echo “script starting”
echo $sample_text
foo
echo “script ended”
echo $sample_text
exit 0
define local
variable
Output?
Check the
scope of
the
variables
www.vibranttechnologies.co.in
29. 29
Function
Use return to pass a result
#!/bin/sh
yes_or_no() {
echo “Is your name $* ?”
while true
do
echo –n “Enter yes or no:”
read x
case “$x” in
y | yes ) return 0;;
n | no ) return 1;;
* ) echo “Answer yes or no”
esac
done
}
echo “Original parameters are $*”
if yes_or_no “$1”
then
echo “Hi $1, nice name”
else
echo “Never mind”
fi
exit 0
Output
./my_name John Chuang
Original parameters are John Chuang
Is your name John?
Enter yes or no: yes
Hi John, nice name.
www.vibranttechnologies.co.in
30. 30
Command
External:
use interactively
Internal:
only in script
break
skip loop
#!/bin/sh
rm –rf fred*
echo > fred1
echo > fred2
mkdir fred3
echo > fred4
for file in fred*
do
if [ -d “$file” ] ; then
break;
fi
done
echo first directory starting fred was $file
rm –rf fred*
exit 0
www.vibranttechnologies.co.in
31. 31
Command
: treats it as true
#!/bin/sh
rm –f fred
if [ -f fred ]; then
:
else
echo file fred did not exist
fi
exit 0
www.vibranttechnologies.co.in
32. 32
Command
continue continues next iteration
#!/bin/sh
rm –rf fred*
echo > fred1
echo > fred2
mkdir fred3
echo > fred4
for file in fred*
do
if [ -d “$file” ]; then
echo “skipping directory $file”
continue
fi
echo file is $file
done
rm –rf fred*
exit 0
www.vibranttechnologies.co.in
34. 34
Command
echo print string
-n do not output the trailing newline
-e enable interpretation of backslash escapes
0NNN the character whose ACSII code is NNN
backslash
a alert
b backspace
c suppress trailing newline
f form feed
n newline
r carriage return
t horizontal tab
v vertical tab Try these
% echo –n “string to n output”
% echo –e “string to n output”
www.vibranttechnologies.co.in
35. 35
Command
eval evaluate the value of a parameter
similar to an extra ‘$’
% foo=10
% x=foo
% y=‘$’$x
% echo $y
Output is $foo
% foo=10
% x=foo
% eval y=‘$’$x
% echo $y
Output is 10
www.vibranttechnologies.co.in
36. 36
Command
exit n ending the script
0 means success
1 to 255 means specific error code
126 means not executable file
127 means no such command
128 or >128 signal
#!/bin/sh
if [ -f .profile ]; then
exit 0
fi
exit 1
Or % [ -f .profile ] && exit 0 || exit 1
www.vibranttechnologies.co.in
37. 37
Command
export gives a value to a parameter
This is ‘export2’
#!/bin/sh
echo “$foo”
echo “$bar”
This is ‘export1’
#!/bin/sh
foo=“The first meta-syntactic variable”
export bar=“The second meta-syntactic variable”
export2
Output is
%export1
The second-syntactic variable
%
www.vibranttechnologies.co.in
38. 38
Command
expr evaluate expressions
%x=`expr $x + 1` (Assign result value expr $x+1 to x)
Also can be written as
%x=$(expr $x + 1)
Expr1 | expr2 (or) expr1 != expr2
Expr1 & expr2 (and) expr1 + expr2
Expr1 = expr2 expr1 – expr2
Expr1 > expr2 expr1 * expr2
Expr1 >= expr2 expr1 / expr2
Expr1 < expr2 expr1 % expr2 (module)
Expr1 <= expr2 www.vibranttechnologies.co.in
39. 39
Command
printf format and print data
Escape sequence
backslash
a beep sound
b backspace
f form feed
n newline
r carriage return
t tab
v vertical tab
Conversion specifier
%d decimal
%c character
%s string
%% print %
% printf “%sn” hello
Hello
% printf “%s %dt%s” “Hi
There” 15 people
Hi There 15 people
www.vibranttechnologies.co.in
40. 40
Command
return return a value
set set parameter variable
#!/bin/sh
echo the date is $(date)
set $(date)
echo The month is $2
exit 0
www.vibranttechnologies.co.in
41. 41
Command
Shift shift parameter once, $2 to $1, $3 to
$2, and so on
#!/bin/sh
while [ “$1” != “” ]; do
echo “$1”
shift
done
exit 0
www.vibranttechnologies.co.in
42. 42
Command
trap action after receiving signal
trap command signal
signal explain
HUP (1) hung up
INT (2) interrupt (Crtl + C)
QUIT (3) Quit (Crtl + )
ABRT (6) Abort
ALRM (14) Alarm
TERM (15) Terminate
www.vibranttechnologies.co.in
43. 43
Command
#!/bin/sh
trap ‘rm –f /tmp/my_tmp_file_$$’ INT
echo creating file /tmp/my_tmp_file_$$
date > /tmp/my_tmp_file_$$
echo “press interrupt (CTRL-C) to interrupt …”
while [ -f /tmp/my_tmp_file_$$ ]; do
echo File exists
sleep 1
done
echo The file no longer exists
trap INT
echo creating file /tmp/my_tmp_file_$$
date > /tmp/my_tmp_file_$$
echo “press interrupt (CTRL-C) to interrupt …”
while [ -f /tmp/my_tmp_file_$$ ]; do
echo File exists
sleep 1
done
echo we never get there
exit 0 www.vibranttechnologies.co.in
45. 45
Command
Unset remove parameter or function
#!/bin/sh
foo=“Hello World”
echo $foo
unset $foo
echo $foo
www.vibranttechnologies.co.in
46. 46
Pattern Matching
find search for files in a directory hierarchy
find [path] [options] [tests] [actions]
options
-depth find content in the directory
-follow follow symbolic links
-maxdepths N fond N levels directories
-mount do not find other directories
tests
-atime N accessed N days ago
-mtime N modified N days ago
-new otherfile name of a file
-type X file type X
-user username belong to username
www.vibranttechnologies.co.in
47. 47
Pattern Matching
operator
! -not test reverse
-a -and test and
-o -or test or
action
-exec command execute command
-ok command confirm and exectute command
-print print
-ls ls –dils
Find files newer than while2 then print
% find . –newer while2 -print
www.vibranttechnologies.co.in
48. 48
Pattern Matching
Find files newer than while2 then print only files
% find . –newer while2 –type f –print
Find files either newer than while2, start with ‘_’
% find . ( -name “_*” –or –newer while2 ) –type f
–print
Find files newer than while2 then list files
% find . –newer while2 –type f –exec ls –l {} ;
www.vibranttechnologies.co.in
49. 49
Pattern Matching
grep print lines matching a pattern
(General Regular Expression Parser)
grep [options] PATTERN [FILES]
option
-c print number of output context
-E Interpret PATTERN as an extended regular expression
-h Supress the prefixing of filenames
-i ignore case
-l surpress normal output
-v invert the sense of matching
% grep in words.txt
% grep –c in words.txt words2.txt
% grep –c –v in words.txt words2.txt
www.vibranttechnologies.co.in
50. 50
Regular Expressions
a regular expression (abbreviated as regexp or regex, with
plural forms regexps, regexes, or regexen) is a string that
describes or matches a set of strings, according to certain syntax
rules.
Syntax
^ Matches the start of the line
$ Matches the end of the line
. Matches any single character
[] Matches a single character that is contained within the
brackets
[^] Matches a single character that is not contained within the
brackets
() Defines a "marked subexpression”
{x,y}Match the last "block" at least x and not more than y
times
www.vibranttechnologies.co.in
51. 51
Regular Expressions
Examples:
".at" matches any three-character string like
hat, cat or bat
"[hc]at" matches hat and cat
"[^b]at" matches all the matched strings from
the regex ".at" except bat
"^[hc]at" matches hat and cat but only at the
beginning of a line
"[hc]at$" matches hat and cat but only at the
end of a line
www.vibranttechnologies.co.in
52. 52
Regular Expressions
POSIX class similar to meaning
[:upper:] [A-Z] uppercase letters
[:lower:] [a-z] lowercase letters
[:alpha:] [A-Za-z] upper- and lowercase letters
[:alnum:] [A-Za-z0-9] digits, upper- and lowercase
letters
[:digit:] [0-9] digits
[:xdigit:] [0-9A-Fa-f] hexadecimal digits
[:punct:] [.,!?:...] punctuation
[:blank:] [ t] space and TAB characters only
[:space:] [ tnrfv]blank (whitespace) characters
[:cntrl:] control characters
[:graph:] [^ tnrfv] printed characters
[:print:] [^tnrfv] printed characters and space
Example: [[:upper:]ab] should only match the uppercase letters
and lowercase 'a' and 'b'.
www.vibranttechnologies.co.in
53. 53
Regular Expressions
POSIX modern (extended) regular
expressions
The more modern "extended" regular expressions
can often be used with modern Unix utilities by
including the command line flag "-E".
+ Match one or more times
? Match at most once
* Match zero or more
{n} Match n times
{n,} Match n or more times
{n,m} Match n to m times
www.vibranttechnologies.co.in
54. 54
Regular Expressions
Search for lines ending with “e”
% grep e$ words2.txt
Search for “a”
% grep a[[:blank:]] word2.txt
Search for words starting with “Th.”
% grep Th.[[:blank:]] words2.txt
Search for lines with 10 lower case characters
% grep –E [a-z]{10} words2.txt
www.vibranttechnologies.co.in
55. 55
Command
$(command) to execute command in a script
Old format used “`” but it can be confused with
“’”
#!/bin/sh
echo The current directory is $PWD
echo the current users are $(who)
www.vibranttechnologies.co.in
56. 56
Arithmetic Expansion
Use $((…)) instead of expr to evaluate arithmetic equation
#!/bin/sh
x=0
while [ “$x” –ne 10]; do
echo $x
x=$(($x+1))
done
exit 0
www.vibranttechnologies.co.in
57. 57
Parameter Expansion
Parameter Assignment
foo=fred
echo $foo
#!/bin/sh
for i in 1 2
do
my_secret_process ${i}_tmp
done
#!/bin/sh
for i in 1 2
do
my_secret_process $i_tmp
done
Gives result
“mu_secret_process:
too few arguments”
${param:-default} set default if null
${#param} length of param
${param%word} remove smallest suffix pattern
${param%%word} remove largest suffix pattern
${param#word} remove smallest prefix pattern
${param##word} remove largest prefix pattern
www.vibranttechnologies.co.in
59. 59
Here Documents
A here document is a special-purpose code block, starts
with <<
#!/bin.sh
cat <<!FUNKY!
hello
this is a here
document
!FUNCKY!
exit 0
#!/bin.sh
ed a_text_file <<HERE
3
d
.,$s/is/was/
w
q
HERE
exit 0
Output
That is line 1
That is line 2
That was line 4
a_text_file
That is line 1
That is line 2
That is line 3
That is line 4
www.vibranttechnologies.co.in
60. 60
Debug
sh –n<script> set -o noexec check syntax
set –n
sh –v<script> set -o verbose echo command before
set –v
sh –x<script> set –o trace echo command after
set –x
set –o nounset gives error if undefined
set –x
set –o xtrace
set +o xtrace
trap ‘echo Exiting: critical variable =$critical_variable’
EXIT
www.vibranttechnologies.co.in