0

I need to create/access a directory contain spaces. I know that I can create in this way mkdir -p ' asd qwe'.

But I need to put that value to a variable and access it. Following will script create 2 directory as expected.

   FOL="asd qwe"    
   mkdir -p "$FOL"

But how can I assign that value to a single variable and do it?

3
  • 3
    Following will script create 2 directory as expected -- No the command creates a single directory named asd qwe Commented Feb 25, 2015 at 11:26
  • 3
    It works fine to me. Commented Feb 25, 2015 at 11:26
  • Sorry guys. It working for me also. I don't know why it was working for me initially. If I get to know why it was not working earlier I will update here. Commented Feb 25, 2015 at 11:37

2 Answers 2

1

Exactly as you wrote it:

FOL="asd qwe"    
mkdir -p "$FOL"

will make a single directory called asd qwe

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry guys. It working for me also. I don't know why it was working for me initially. If I get to know why it was not working earlier I will update here
0

your script is doing what you need

root@asd:~# FOL="asd qwe"
root@asd:~# mkdir -p "$FOL"
root@asd:~# ll
total 4
drwxr-xr-x 2 root root 4096 Feb 25 13:29 asd qwe

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.