Author: Ramdev


Bash Scripting – Redirecting output in scripts

You can use the STDOUT and STDERR file descriptors in your scripts to produce output in multiple locations simply by redirecting the appropriate file descriptors. There are two methods for redirecting output in the script: Temporarily redirecting each line Permanently redirecting all commands in the script...


Bash Scripting – Controlling the Loop

You might be tempted to think that after you start a loop, you’re stuck until the loop finishes all its iterations. This is not true. A couple of commands help us control what happens inside of a loop: The break command The continue command Each command...


Bash Scripting – the for command

Iterating through a series of commands is a common programming practice. Often, you need to repeat a set of commands until a specific condition has been met, such as processing all the files in a directory, all the users on a system, or all the lines...


Bash Scripting – Trying the Test Command

So far, all you’ve seen in the if statement line are normal shell commands. You might be wondering if the bash if-then statement has the ability to evaluate any condition other than a command’s exit status code. The answer is no, it can’t. However, there’s a...

Page 52 of 74