Using MKDIR via shell script

Asked

Viewed 230 times

-1

I am trying to create a directory via shell script, using the command:

mkdir -m755 "/var/www/app.dominio.com/html/$1"

where the folder name is passed by parameter, you are getting a question mark "name_da_folder?" at the end and it is inaccessible, what I must do to make it properly created?

  • 2

    More details are missing: How are you passing the name of the folder? What do you call your script? Do you have the script you are doing? I did some tests and I did not have this error that you’re having

  • 1

    I found that the error was the line breaking character due I have created the script in windows.

2 answers

1

How did not pass more details (nor the tests you’ve done, nor your script), I might end up suggesting something you’ve already done.

In the script (using your example), you use:

mkdir -m755 "/var/www/app.dominio.com/html/$1" (just like you’re doing)

And in the script call (which is the most important), you do:

$ ./meu_querido_script nome_da_pasta

If this does not work, check the permissions in the directory, or post your complete script (if there is).

Obs: I performed the tests exactly as I mentioned and it worked, if it doesn’t work we can continue the discussion.

0

After several attempts I discovered that the problem was due to I created the script in windows, because it puts a line breaking character different from the one accepted in linux.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.