I cannot figure out why my script is not creating a folder from my input.
Heres my code …
#!/bin/bash
echo "Please enter a foldername to store archives in"
read $2
echo "++++++++++++++++++++++++++"
mkdir $2
echo "++++++++++++++++++++++++++"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You use a wrong variable to store the directory name $2 is the second parameter given to your script when you execute it (it could be empty if no second parameter). However i never tested but maybe it could work. The main problem is that for a the read function, you provide the variable without a ‘$’.
Try to declare a variable.