Home » Bash Scripting

Bash Scripting

Bash Scripting Basics: Part 1

If you have been using computers for a while, whether you have been using Unix, Windows or Mac operating systems, you’re probably already familiar with the term shell. A shell is piece of software that is inbuilt into most operating systems which acts as an interface to the kernel and other software. Shells come in various shapes and sizes, but in …

Read More »

DOS-to-UNIX file conversion

Using Perl: # WARNING! For UNIX only! Do not use with ActivePerl in MSYS shell on Windows! # (Returns error message and file is deleted.) perl -pi -e 's/\r\n/\n/g' filename Using sh or bash: Works fine even in MSYS shell on Windows. #tr -d '\r' < original_filename > new_filename (Note that the “<” and “>” must be typed for this command to work). …

Read More »

HowTo Run a Script In Linux

How do I run a Linux shell script? How can I run a script in Linux? By default script will not run. You need to set execute permission for your script. To execute or run script type the following command: chmod +x script-name-here OR chmod 0755 script.sh Use the ls command to view permission on the script: $ ls -l …

Read More »

Bash Scripting Basics: Part 2 – Statements and variables

Now that we know how to create a very basic script and run them its time to get started on learning how statements and variables work. Every language has itsown way of using statements and variables, they might look slightly different when comparing one language to another, but they all have the same goal in mind. That makes bash scripting the ideal …

Read More »