Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux Shell Scripting

This task takes me through practical steps in learning Linux bash scripting.


Task One

Creating Directories

  1. I created a folder named shell-scripting. Screenshot of the shell-scripting folder creation

  2. I used the cd command to change into the shell-scripting folder before creating the my_first_shell_script.sh file. Screenshot of navigating into the shell-scripting folder

  3. Using Vim, I created a file called my_first_shell_script.sh. Screenshot of the file creation using Vim

  4. I used ls -latr to confirm that the file was successfully created. Screenshot of the file listing

  5. I ran the script using ./my_first_shell_script.sh but got an error: "Permission denied!" because the file wasn't executable, as I noticed in the file listing. Screenshot of the permission denied error


Task Two

Adding Permissions to the File

  1. I added executable permission to the file using chmod +x my_first_shell_script.sh. Screenshot of adding executable permissions

  2. I ran the shell script and noticed that only the folders were created. Screenshot of running the shell script

Note: I couldn't create the users because I am running Vim and Terminal on macOS, and the useradd command is not supported. This is why it didn't run.


Task Three

Variable Declaration and Initialization

  1. In my shell, I was able to create a variable called name and retrieve its value from the terminal. Screenshot of variable declaration and retrieval

Adding Comments

# This is a single-line comment in Bash
echo "Hello, you are learning Bash Scripting on DAREY.IO!" # This is also a comment, following a command
# This is another way to create
# a multi-line comment. Each line
# is prefixed with a # symbol.
echo "Here is an actual code that gets executed"

Conclusion

I was able to successfully complete the tasks, including creating directories, adding permissions to files, and working with variables in Linux shell scripting. However, due to the limitations of macOS, I couldn't use the useradd command to create users.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages