2
Shell scripts to automate tasks and make your life with Linux Shell Scripting easier WHAT IS A SHELL SCRIPT? The course begins by describing easy scripts to automate frequently executed commands and continues by describing conditional logic, user interaction, loops, menus, traps, and functions. This course is meant for system directors UN agency have down the fundamentals of a UNIX operative atmosphere (OE) like the Solaris OE or UNIX system and UN agency would love to scan and perceive the varied boot scripts and write their own scripts to modify their regular tasks. Having the capability to run a script is nice however if the script can’t question the user for data and should have onerous coded data, the utility of the script are going to be severely restricted. There are times once a script can wish to grasp a path, what to call a file or folder, the default price for a variable and then on and then forth. This could be tired a really easy manner mistreatment scan. Scan can prompt the user to enter data. Before mistreatment scan it's a decent plan to initial use echo to request what data is required. That method the user is aware of what to enter. A straightforward example may be seen in listing one wherever scan is employed to urge the name of a folder that's being created by the script. Commands designed into shell: For this tutorial demonstration, we are going to examine 2 most often used intrinsically commands during a shell programming atmosphere. Once command is intrinsically to the shell that merely means the program we are going to run can’t be found anyplace in our Winchester drive (like different programs such as: mount, who is, etc.)

Shell scripts to automate tasks and make your life with linux shell script easier

Embed Size (px)

Citation preview

Page 1: Shell scripts to automate tasks and make your life with linux shell script easier

Shell scripts to automate tasks and make your life with Linux Shell Scripting easier

WHAT IS A SHELL SCRIPT?

The course begins by describing easy scripts to automate frequently executed commands and continues by describing conditional logic, user interaction, loops, menus, traps, and functions. This course is meant for system directors UN agency have down the fundamentals of a UNIX operative atmosphere (OE) like the Solaris OE or UNIX system and UN agency would love to scan and perceive the varied boot scripts and write their own scripts to modify their regular tasks.

Having the capability to run a script is nice however if the script can’t question the user for data and should have onerous coded data, the utility of the script are going to be severely restricted. There are times once a script can wish to grasp a path, what to call a file or folder, the default price for a variable and then on and then forth. This could be tired a really easy manner mistreatment scan. Scan can prompt the user to enter data. Before mistreatment scan it's a decent plan to initial use echo to request what data is required. That method the user is aware of what to enter. A straightforward example may be seen in listing one wherever scan is employed to urge the name of a folder that's being created by the script.

Commands designed into shell:

For this tutorial demonstration, we are going to examine 2 most often used intrinsically commands during a shell programming atmosphere. Once command is intrinsically to the shell that merely means the program we are going to run can’t be found anyplace in our Winchester drive (like different programs such as: mount, who is, etc.)

Read command reads the quality input (ex. keyboard) area unit stores the knowledge during a shell variable. The foremost common use of this command is receiving answers to queries and prompts by the running shell script.

Special shell characters:

Some characters have the special which means within the shell. It’s counseled to avoid this characters in filenames since they need special which means in the shell and therefore the actual OS.

File system Troubleshooting:

Although UNIX could be a terribly stable software system, if it crashes for a few reason (for example, thanks to an influence outage), one (or more) of your file systems won't be unmounted properly and so are going to be mechanically checked for errors once UNIX is restarted.

Page 2: Shell scripts to automate tasks and make your life with linux shell script easier

In addition, when the system boots throughout a standard boot, it perpetually checks the integrity of the file systems before mounting them. In each cases this can be performed employing a tool named fsck (“file system check”).