What is Shell Scripting?
Shell Scripting shell แ แ แฐแ แฐแจแฐแ แฐแจแณแณแญ แตแแแแฝแ แฅแแฒแแฝแ แจแแปแ แแฐแต แแแข
Shell operating system แแตแฅ command interpreter(แ แตแฐแญแแ) แแ, แแแณแ Bash in Unix-like systems.
It allows users to automate tasks, perform system administration, manipulate files and directories, and interact with the operating system through the command line interface.
แจแแฃแแแ commands execute แฅแซแจแแ แจแแ แจแ แฐแซ แ แฐแซ แฅแจแแแ แแ แญ แแ shell script แ แแ แแ the whole bunch of code in our script, sequence แ แฅแ execute แฅแแฒแแ แฅแแจแแแแแข
Getting started: Steps to write a shell script
#1. Choose a shellแก แ แฃแ แจแฐแแแฐแ Shell bash (Bourne Again Shell) แฒแแ แญแ แ แ แฅแ Unix-like systems แแญ default แแแข
#2. Setup your environmentแก Open a terminal or command prompt on your system.
#3. Script แแญแ แแแ แญแก Text editors like Vim, nano, or any other other text editor แ แแ แแ แ .sh extension แจแแซแแ script แแแ แญแฃ แแแณแ new_script.sh
Extension แแแแ แจfile name แแฅแ แจแแแฃ แจแแญแแ type แแญแ format แจแแแแจแ แจfile name part แแแข แแแณแ sample.txt แแญ แ แแจแจแป แซแแ .txt extension แจแแแแจแ แแญแ text file แฅแแฐแแ แแแข
#4. Set Permissions (Unix-like Systems): Make the script executable by running chmod +x new_script.sh.
...แญแแฅแแ
#ShellScripting
@python_pioneers
@python_pioneers
๐5โก3๐1
This media is not supported in your browser
VIEW IN TELEGRAM
More On Shell Scripting
แจvideoแแ แแฅแซแชแซ แจแแฃแญ post แแแแต แตแฝแแแฝแ ๐๐๐๐
#ShellScripting
@python_pioneers
@python_pioneers
แจvideoแแ แแฅแซแชแซ แจแแฃแญ post แแแแต แตแฝแแแฝแ ๐๐๐๐
#ShellScripting
@python_pioneers
@python_pioneers
More On Shell Scriptingแฃแแแ แฅแแณแจแแ แจshell scripting แแ purpose tasks automate แแแจแ แแแข แแแตแ commands แ แแต แ แ แแต แฅแจแแแ terminal แแญ execute แจแแจแ แ แ แแด script แฅแแ แแ แตแ แฐแต/ bug แฅแตแจแแแ แต แตแจแต every lines will be executed one after the other.
แแแณแ แก
แ แแต "Hello, Ethiopia!" แฅแ terminal แแญ print แจแแซแจแ แจshell script แฅแแแแฃ แแ แแฐแฑแ แแแจแณแต แจแแญ แซแแแ แ แญแญ video แฐแแแจแฑแข
1. แ แแแแชแซ text editor แฅแแจแแณแแ (such as nano, vim, or gedit) and hello.sh แจแฐแฃแ file แฅแแแฅแซแแแข แฅแแ video แแญ แจแฐแ แแแแ text editor nano แแแข
nano hello.shแจแ แแญแ แแตแฅ แฅแแแ แ แแแฎแฝ แฅแแ แแแ
#!/bin/bash#line_1 "#!/bin/bash" /shebang line/ แฅแแ แจแแญ แจแแแแ scriptu แ bash shell interpreter execute แฅแแฒแแแแ แแ แข
# This is a comment
echo "Hello, Ethiopia!"
แ programming comment แจแแแแ a text still in the code yet not executed, แ shell Scripting comment แแแ แจแแแแ textun แ "#" แฅแแแแซแแแข
แแแณแ the 2nd line of our script does nothing because it is a comment.
Interpreter แจแแแแ itself is a program that translates and executes code written in a high-level programming language in to machine code(which is understandable by the computer).
2. แจแ แ แแ we will save our hello.sh script file.
nano แจแแตแ แแ แจแแ แแแแชแซ แแญ "CTRL - O" to save the file then "CTRl - X" to exit from the text editor.
3. แ แแฃแญ แจแแแจแแ script แแญแแ executable แแจแ แแ: แแญแ permission แแตแ แต แแ for the file to be executed.
แตแ file permission แ แแฃแญ แฅแแแซแแ but for now just do this.
chmod +x hello.sh4. แ แแจแจแป แจแแจแ แแแญ scriptun run แแจแ แแแฃ to do this:
./hello.shแญแ script run แตแแจแแ bash interpreter แ แแ แแ the code runs and a text "Hello, Ethiopia!" is printed in our terminal, this was done by the command "echo".
แญแ แแแ แแณแ แแ แแแฝ แฎแถแฝแ แ แแแ shell Scripting แฐแแแแฑแข
#ShellScripting
#PythonPioneers
@python_pioneers
@python_pioneers
@python_pioneers
๐3๐ฅ2