Example 2
/* #!/bin/bash
# This is a simple Bash script
# Prompt the user for their name
echo “Hello! What’s your name?”
read name
# Print a personalised greeting
echo “Nice to meet you, $name!” */
Save this code in a file with a .sh extension, for example, greeting.sh. To make it executable, run the following command in the terminal:
/* chmod +x greeting.sh */
Now you can execute the script:
/* ./greeting.sh */
.sh | File Format
A .sh file is a scripting language command file containing a computer program that can be run by the Unix shell. It can contain a series of commands that run sequentially to perform operations such as file processing, program execution, and other similar tasks. These are run from the command line interface by the user or in batch mode to perform multiple operations simultaneously. Script files can be opened in text editors such as Notepad, Notepad++, Vim, Apple Terminal, and other similar applications on Windows, MacOS, and Linux.
Contact Us