I have something like this:
package="com.program.interesting.program.aplication"
I want a script that will create folders like this:
midir com
cd com/
mkdir program
cd program/
...
etc
But I want to do this automatically, no matter how many folder I’ll have. I guess this is very simple, but I don’t know how to parse a string on the shell and I don’t want to read a book, just to solve this.
Thanks
You just need to convert
.to/and that is all:The
-pkey means thatmkdirneeds to create all necessary parent directories automatically.Use
""around the command substitution$()if it is possible that$packagecan contain spaces inside.The
trcommand changes the.symbols in the string to slashes.e.g.