Skip to content

CodeFatherTech

Learn to Code. Shape Your Future

  • Blog
  • Courses

Learn Bash Scripting

Bash Export Command: Everything You Need To Know

December 8, 2024July 4, 2020 by Claudio Sabato

The export command is a built-in command of the Bash shell that is very handy to know when you work on Linux systems or create Bash scripts. What does the export command do in Linux? The export command is used to make variables or functions in the current shell environment also available to child processes … Read more

Categories Blog Tags Learn Bash Scripting Leave a comment

Bash Syntax Error Near Unexpected Token: How to Fix It

June 27, 2025June 29, 2020 by Claudio Sabato

Have you ever seen the message “syntax error near unexpected token” while running one of your Bash scripts? In this guide, I will show you why this error occurs and how to fix it. “Error Near Unexpected Token” is a Bash syntax error that reports bad syntax in your script or command. Many things can … Read more

Categories Blog Tags Learn Bash Scripting Leave a comment

Bash Sleep Command: A Quick Guide to Use It in Your Scripts

June 27, 2025April 8, 2020 by Claudio Sabato

The Bash sleep command delays the execution of the command after it for a given amount of time. The sleep time is expressed in seconds. The use of the sleep command is common when scheduling a task every X seconds or when a script relies on another script to complete its execution. These are three … Read more

Categories Blog Tags Learn Bash Scripting Leave a comment

How do I check if a file or directory exists using Bash?

December 8, 2024March 19, 2020 by Claudio Sabato

In Bash scripts is very common to check if a file or a directory exist. How do you check if a file or a directory exists using Bash? In Linux everything is a file. You can use the test command followed by the operator -f to test if a file exists and if it’s a … Read more

Categories Blog Tags Learn Bash Scripting Leave a comment

How do I use the cURL command in a Bash Script?

June 27, 2025March 8, 2020 by Claudio Sabato

Using the cURL command in a Bash script can be useful, but why? We live in the era of APIs… …you ask for data and you get it back… But how can you know if your API request is successful? HTTP response codes are able to tell you that, for example, a successful request is … Read more

Categories Blog Tags Learn Bash Scripting 4 Comments

How to Get the Directory of a Bash Script

June 27, 2025March 5, 2020 by Claudio Sabato

Have you ever tried to get the directory of your Bash script programmatically? It’s a common thing people ask and it can be done in different ways. The first thing to look at to solve this problem is the $0 variable, used in Bash to store the first element of the command executed. Create a … Read more

Categories Blog Tags Learn Bash Scripting 3 Comments

Exit a Bash Script: exit 0 and exit 1 Explained

June 27, 2025February 26, 2020 by Claudio Sabato

Why would you exit from a Bash script? Let’s say you are writing a script…there’s one thing that is almost certain… At some point, your script is likely to break because of unexpected conditions you might have not considered. So, what can you do about it? How can you exit a Bash script in case … Read more

Categories Blog Tags Learn Bash Scripting 1 Comment

Loop Through the Lines of a File: Bash For Loop Explained

June 27, 2025February 24, 2020 by Claudio Sabato

I want to loop through the lines of a file with a Bash script and one of the ways to do it is using a for loop. What is a for loop? A for loop is one of the most common programming constructs and it’s used to execute a given block of code given a … Read more

Categories Blog Tags Learn Bash Scripting 2 Comments

How can I pass arguments to a Bash script?

June 27, 2025February 16, 2020 by Claudio Sabato

In this article, we will create a simple Bash script and show how to pass arguments to it using the Linux command line. How can you pass arguments to a Bash script? Arguments passed to a Bash script follow the name of the script in the command line and they are separated from each other … Read more

Categories Blog Tags Learn Bash Scripting 4 Comments
Newer posts
← Previous Page1 Page2

CONTACT US

Email: hello@codefather.tech

  • About Claudio Sabato
  • Privacy Policy
  • Terms and Conditions
  • Acceptable Use Policy
  • Affiliate Disclaimer
© 2025 CodeFatherTech

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in .

CodeFatherTech
Powered by  GDPR Cookie Compliance
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.