In the previous article, you created a script using redirection. Script it to a minimum, minimalist. All programs even a single line, requiring documentation. The information must include at least the author, date, and description of the Peralta. Open the ' bin/hw ' file in your text editor, and add the information in the list of 1-1 using comments;

Listing 1-1.hw
# nama script : hw
# date : 13/09/2019
# author : Akucode
Printf “%s\n” “Hello, World”

            Comments on bash start with Octothorpe or with a hash (#), at the beginning of the word and continue to the end of the line. Bash will ignore the line if there is such a sign at the beginning of the word, I often add the type of comment after the hash sign then I can search for the type of file I want, and ignore other comments.


Below are the commands, concepts, and variables you learned from the first article.


·       PWD: Prints the name of the currently used directory.
·       CD: Switches the directory from the one used today.
·       Echo: Prints an argument separated by a space and ended by a new line.
·       Type: Displays information about a command.
·       Mkdir: Creates a new directory.
·       Chmod: Change the permissions of a file.
·       Source: a.k.a.. (dot): Executes the script on the current bash program.
·       Printf: Prints the arguments specified by the format string.


·       Script: The file in which there is a command to execute by bash.
·       Word: A is a character that is regarded as a single unit by bash.
·       Output redirection: You can send the output from the terminal to a file by using the command "> FileName".
·       Comments: Consists of a hash-initiated word (#). All characters that are contained after the hash on that line are comments and will be ignored by bash.
·       Variable: The entity that is the place of value.
·       Shebang or Hash-bang: A fence mark and an exclamation mark (#!) followed by the path to the interpreter that is required to execute the file.
·       Interpreter: A program that reads the file and executes a statement according to the contents of the file. It can be a shell or other languages such as awk or Python.


·       PWD contains the pathname of the currently used directory.
·       HOME saves the pathname from the home user directory.

·       PATH is a list of directories separated by a colon that merfeeds where the command files are stored. Shell searches for this directory to find out the commands requested to be executed.

After reading a bash article from scratch it's time to try what you've read, whether you still remember it and can make it, here's an exercise for you to work on, try it! To practice science!

1.     Write the script to create a directory named ' BPL ' in the $HOME. Then populate this directory with two subdirectories, bin, and script.
2.     Write the script to create a "Hello, World!" script, HW, in the directory $HOME/bpl/bin/; Make it be executable and run.


Previous Post Next Post

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel