Monday, June 10, 2019

Bash part one Hello Hacking a rise

welcome to hacking a rise in this post we going to show you some basic Bash (aka shell) scripting with a script called hello world we going to explain with bash is and with the functions are as we progress on this part the blog now instead reading this and get stuck in to this

What is Bash

Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been distributed widely as the default login shell for most Linux distributions and Apple’s macOS

Your First Script: “Hello, Hackingarise!”

For your first script, we will start with a simple program that returns a
message to the screen that says “Hello, Hackingarise!” Open your text
editor, and let’s go.
To start, you need to tell your operating system which interpreter you
want to use for the script. To do this, enter a shebang, which is a
combination of a hash mark and an exclamation mark, like so:
#!
You then follow the shebang ( #! ) with /bin/bash to indicate that you
want the operating system to use the bash shell interpreter. As you’ll see
in later chapters, you could also use the shebang to use other interpreters,
such as Perl or Python. Here, you want to use the bash interpreter, so
enter the following:
#! /bin/bash
Next, enter the echo command, which tells the system to simply repeat
(or echo) back to your monitor whatever follows the command.
In this case, we want the system to echo back to us with hello hacking a rise

#! /bin/bash
# the first bash script i worte whoop whoop
echo “Hello, Hackingarise!”

see a line that’s preceded by a hash mark ( # ). This is a
comment, which is a note you leave to yourself or anyone else reading the
code to explain what you’re doing in the script. Programmers use
comments in every coding language.

#! /bin/bash
Next, enter the echo command, which tells the system to simply repeat
or echo back to your monitor whatever follows the command. In this case, we want the system to echo back to us “Hello, hackingrise!”
then gave gave is permission to run so type this command chmod +x hackingarise.sh

Hacking A Rise scripthackingarise-300x43

Hacking A Rise bashecho-300x67

So, now we have a simple script. All it does is echo back a message to standard output. If we want to create more advanced scripts we will likely
need to add some variables. There ya go your first script in bash well done

in the next post we talk a little about Adding Functionality with Variables and User Input to scripts till next time peace out bitches

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.