I'm trying to create a command in the .bashrc of ubuntu, however I'm having a problem, I'm trying to create a folder with the variable entered at the time of calling the alias, but this is giving an error. When I open the terminal it already asks for the folder name, but I do not want this, I want to type the command anywhere. What am I doing wrong?
#comando digitado no terminal
username@username:~$ pasta nome_pasta
Where folder is the name of the alias, and folder_name is the variable obtained by read.
If I'm doing this I way wrong what would be the best method to have a command like the one above?
My code looks like this:
# arquivo .bashrc
function CreateFolder(){
if [ -n "$USER" ]; then
alias pasta='mkdir $name'
read name
else
echo "Error :/"
fi
}
CreateFolder
Thank you in advance for your help.