When the shell script is named command to execute, it searches for that name in the directory listed in the PATH variable. This variable contains a list of directories separated by a colon that contains commands to execute. This is a hallmark of $PATH;

            /bin:/usr/bin:/usr/local/bin:/usr/games

            If your shell script is not in any of the PATH directories, then you should provide a pathname, either in absolute or relative, to be discovered by bash. Pathname Absolute provides the location of the root filesystem, e.g./HOME/FATTAHKUS/BIN/HW; While the relative a pathname is given as it relates to the Active Directory in the current command shell, as in/BIN/HW.
            The command is usually stored in a directory named Bin, and the user's personal program is in the subdirectory of the bin in the $HOME directory. To create a directory in bash use this command:
            “mkdir bin”

            Now the bin directory is already created and there, they must be added to the variable PATH:
            “PATH=$PATH:$HOME/bin’
 


           For this change to be applied to every shell you open, add the It uke file to be taken by the shell when running. And it would be ". bash_profile", ". BASHRC", or ". Profile" depending on how you call bash to be stuck. This File is only sourced for an interactive shell, not for scripts.

Create a file and run the script usually, you will use the text editor to create the program, but for this simple script it is not necessary to use the text editor, simply create a command line to save and write the script in the command shell:

            “echo echo Hello, World > bin/hw”



           The larger sign (>) tells the bash shell to send the output of the command to the specified file instead of the display to the terminal. You'll learn more about redirects to upcoming articles.

Now the program can be run by calling it an argument against shell commands;



            The program has worked, but it doesn't fully satisfy you have to type ' bash ' first to run it. To call it without ' bash ' you have to give it permission to execute "chmod + x bin/hw". Now the command can be executed simply by calling the program filename;



Next, choose and use the text editor. For many people, one of the most important parts of computer software is word processing software, and I also use it to write this article (Microsoft Word). That's not something I often use. The text editor, on the other hand, is an indispensable tool. And I use the above one to write emails, articles and more.

            The text editor operates on a plain text file. The text editor only saves what you type; It does not add Idden formatting code. If I type the letter A and press Enter in the text editor and click Save. The File will contain two characters: letter A and A Newline.

You can write programming in any text editor, from basic E3 or Nano to Emacs or Nedit, and full-featured text EmEditor. Better text Editor lets you open more than one file at a time. They make code editing easier with syntax highlighting, automatic indentation, autocompletion, spell checking, macros, search and replace, and undo. I use Sublime Text 3.







0Comments

Previous Post Next Post

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel