20.2.5 Execution Control of Script
20.2.5.1 Optional Processing according to Conditions
It is “if” statement and “case” statement to be used to selectively process commands depending on a certain condition.
● “if” statement
20.2.5 Execution Control of Script
20.2.5.1 Optional Processing according to Conditions
It is “if” statement and “case” statement to be used to selectively process commands depending on a certain condition.
● “if” statement
20.2.4 Operations in Script
20.2.4.1 Assignment Operation
When we define a new variable or we assign a value to a variable in a script, it is called an assignment. The operator used in this case is “=”. This is called assignment mode, and the basic format is as follows.
20.2.3 Basics of Script Syntax
In this section, we will describe various rules and syntax for writing scripts.
20.2.3.1 Definition of Script
Script is basically a text file. Internally, the file is defined as a script, and is differentiated from a normal text file. Defining that the file is the script is the value you enter at the beginning of the line as follows.
20.2.2 How Shell Runs Commands
20.2.2.1 Types of Kernel’s System Calls
● “fork” system call
This call is one of the system call methods that a process uses to execute another process. When a command needs to be executed, a child process is created and executed separately.
20.2 Batch Run of Commands via Script
Here we will look at the script tool we use to process multiple commands in batch at once. We will discuss the concept of script, how to write a script, how to execute a script, and so on.
20.2.1 Shell and script
20.2.1.1 What is Script?
On Linux systems, Shell plays a central role in executing commands. Among the various Shell programs, BASH is specified as the default shell. BASH receives a command entered by the user in the terminal environment, interprets the meaning of the command, processes the command according to the specified method, and returns the processing result to the user.
20.1.2 Manual Run and Automatic Run
Based on the subject who instructs the processing, the processing method can be divided into the manual execution and utomatic execution can
● Manual execution
In this method, the user instructs to process certain commands. The user determines the required point of time for execution, and the user also determines the contents of the specific command to be entered for execution and instructs the command. The command to be executed here may be an individual command or a bundle of commands defined by a script. Whatever it is, the user will decide the start of the run.
20.1 How to Run Command
There are several ways to execute commands in the Raspberry Pi system. Users can run them one by one, or the computer can handle them automatically. We will take a look at what methods can be used here.
20.1.1 Individual Run and Batch Run
Based on the number of command processed at one time, the processing method can be divided into individual execution and batch execution.
Chapter 20 Batch Run and Automatic Run
Chapter’s Main Topics
This chapter describes the several ways to execute commands on a Linux system. You can execute commands one by one, or you can execute several commands at once. You can also run it manually or let the system run automatically.
In this regard, we will look at the Script tools we use to process multiple commands at once. We will also look at tools that can execute commands at regular intervals.
It includes descriptions on the following topics:
■ Individual execution and batch execution
■ Manual execution and automatic execution
■ Batch execution with script
■ Automatic execution with init script
■ Automatic execution by schedule