The Shell is a layer between the Operating System(OS) and the user.π It is a user interface for access to the operating system and it uses either a command-line interface (CLI) or a graphical user interface (GUI). In Linux and MacOS this CLI is called Terminal, in Windows Command Prompt.
You can write scripts for the shell which can be used for various purposes, such as executing a shell command, running multiple commands together or performing task automation.
It's easy to get started with shell scripting, let`s create a βhello worldβ shell script for Linux:
- Open an editor and write:
#!/bin/bash echo "Hello World"
- Save it with a name of your choice with .sh at the end. (I chose βhello.shβ)
- Open your Terminal at the path where you saved the file.
- Execute
chmod +x hello.sh
to make the file executable. - Execute β./hello.shβ
Thats it! What are you up to today? Anything you want to share about the Shell? Have a nice day!π
Top comments (4)
One of the first Bash commands I learned was
rm -fr .
Not good, but good to know!It seemed like people everywhere I turned were trying to trick others into using this dangerous command.
I never got caught by this or other commands bc others let me in on the 'secret'. ;))
Hehe good that you didn't fall into the trap! My first command was cd. π
Life gets a lot better when you learn to script boring and repetitive things!
Yes I totally agree! π Let's automate things to have time for the interesting things. π©βπ»