LabReport-1 A2 0242220005101251
LabReport-1 A2 0242220005101251
Submitted To
Submitted By
Name : Kazi Tawhid Ibn Monir
Id : 0242220005101251\
Section : 63_A - (A2)
Daffodil International University
DIU Date-1/27/2025
Introduction to Linux Commands
1. Creating Directories and Files
The file hello.sh was opened using a script editor to input the content. A simple shell script
was written to output the text "Hello World".
Script content:
The script content included the shebang (#!/bin/bash) followed by an echo command to
display a message. The content of the file hello.sh was:
=> #! /bin/bash
After creating the file, we learned how to manage file permissions to allow or restrict
access to the script file. This section covers how to make the .sh file executable and how
to modify its permissions.
The ls -al command was used to list detailed file information, including permissions:
=>chmod +x hello.sh
=>./hello.sh
To demonstrate how permissions can be modified, the script file was made non-
executable using chmod -x:
=>chmod -x hello.sh
=>chmod +x hello.sh
=>./hello.sh
=>#! /bin/bash
=>n=123
=>echo $n
After saving the script, we ran it to print the value of the variable n:
=>./hello.sh
DIU Date-1/27/2025
4. User Input in Shell Scripts
In this section, we learned how to interact with users through the terminal and accept user
input in a shell script.
When the script was executed, the terminal requested the user's name and then displayed
it:
=>./hello.sh
DIU Date-1/27/2025