Skip to main content

Bash Scripting

Bash is a powerful Linux terminal application and bash scripting can be used to automate repetitive tasks easily. In this post, we will look at some basic bash scripting.

Bash scripting
[pre class="brush:bash"]

echo “Hello world…”
Sleep 1
echo “How are you?”
read ans
echo “you typed $ans”

chmod +x


How to run a bash script from anywhere
[pre class="brush:bash"]
# create a directory say "bin" under your home directory.
# update your path variable to include this bin directory.
#Put this in .profile or .bash_profle file to make it permanent.
export PATH=$PATH":$HOME/bin"
#or use the following if you want the directory to precedent system directories
# create a script say, "hello" and keep it in your bin directory.
#Give execute permission to the hello script.

echo My first program

# from any directory, you simply type:
$ hello
My first program[/pre]


Popular posts from this blog

How to Safely Uninstall Python from Mac OS X

Mac Laptops comes with Python pre-installed, but if you install another version of Python probably from it might interfere with the default Python installation. Thus it is recommended to install other Python versions through Homebrew or mac ports.

Advantages and Disadvantages of Electro-oculography (EOG)

In the previous post we looked at what is EOG? In this post we will look at the advantages and disadvantages of EOG.

What is your Lucky Colour?

Colours and You
Which colour can bring you luck and enhance your day? This can be identified by calculating the birth number,