Introduction
This challenge aims to test your knowledge of Bash commands and your ability to write a Bash script. In this challenge, you will create a Bash script that creates a new directory.
This challenge aims to test your knowledge of Bash commands and your ability to write a Bash script. In this challenge, you will create a Bash script that creates a new directory.
Create a Bash script named make_directory.sh
that takes a new directory name from the user. If the directory name does not exist in the current location, the script should create the directory. Otherwise, the script should display an error message.
~/project/make_directory.sh
.To run the script, use the following command:
bash make_directory.sh
Output:
Enter directory name
new_directory
Directory created successfully
In this challenge, you have learned how to create a new directory using the mkdir
command in Bash. You have also learned how to write a Bash script that takes user input and performs conditional checks to create a new directory or display an error message.