amazon media file explorer download upload index folder image licenses menu widget Play Pause profile-settings more dots-two-horizontal dots-two-vertical more-vertical pending google-plus hangouts facebook instagram whatsapp spotify telegram twitter vine renren rss youtube twitch vimeo flickr dribble behance deviantart 500px steam github soundcloud skype reddit linkedin lastfm delicious stackoverflow pinterest xing flattr foursquare yelp World

Adding Comment To a Script

In shell scripting, a comment is a readable explanation in a script that is ignored by the interpreter, you can either add a comment about what the script does or you can write a comment about what a specific function/section does in the script.

Either way, a comment makes code easier for humans to understand the code when viewed later on.

Let's see an example:

#!/bin/bash
# Description   : A description of what the script does
# Version       : 1.0
# Author        : Mr. Devsrealmer
# Date          : 30/07/2020

A comment begins with a hash (#) at the beginning of a word, once the shell sees that, it ignores it. However, the first line has #!/bin/bash: This is always the first line of every bash script, and also known as shebang or hashbang.

This looks like a comment, the difference is that it appends an exclamation mark to the comment.

What this line does is to instruct the shell which interpreter to use to run the commands inside the script. If you are running a python script, you would use #!/usr/bin/python, Since we’re writing a bash script, we used #!/bin/bash. you get the idea.

 

Related Post(s)

  • sed (Stream Editor) In Bash Scripting

    Another powerful filter in GNU/Linux is sed (stream editor), which is a program for performing basic editing tasks on the output of another program or on a file. sed or stream editor can be used to p

  • awk In Bash Scripting

    Up until now, we have covered a couple of text processing, from sed to grep to sort, and now we have the big daddy, which is awk. awk (which stands for Aho, Weinberger, and Kernighan - its creators)

  • (Bash Script) Automate Multiple Classicpress & Wordpress Installation + [Caching and SSL]

    If you are tired of using control panels (I am because they are mostly not secure, and most comes loaded with bundles of useless stacks), and want to do everything on the server level, I wrote a menu

  • Functions in Bash

    Functions are modular building blocks for creating powerful and modular scripts, using function makes it easy to isolate a code since it would be in a single building block, which would be isolated f

  • grep (Regular Expression) In Bash Scripting

    We recently discussed filters in bash scripting, in this guide we would look more into the practical usage of using a filter program, and an example of such a program is grep. grep, in its simplest f

  • Sort in Bash Scripting

    We recently just looked at grep in bash scripting, and another commonly used program in bash scripting is the program called sort. Sort is a simple filter that is used to sort lines of text from its