You are not logged in.
I am making a package for amavisd-new (yes I am aware that there is one in community but I can't say I like the way it is done).
I have an install script from which I want to create multiple directories if they do not exist.
So I want to create a directory /var/spool/amavis with subdirectories of var tmp virusmails spammassassin .
I can't seem to be able to find a way to do this on one line.
Kind regards
Benedict White
Offline
Hi,
the following should work:
% mkdir -p /var/spool/avamis/{virusmails,spammassassin}
or if you need to set certain permissions (see install --help for more information):
% install -d /var/spool/avamis/virusmails /var/spool/avamis/spammassassin
Last edited by chimeric (2008-04-26 16:13:18)
Offline
mkdir supports multiple directories? If you are using bash you might use this better readable syntax: mkdir -p /var/spool/amavis/{var,tmp,virusmails,spamassassin}
Offline
If you're not using bash you can always use a for loop, does that count as one line?
for dir in var tmp virusmails spamassassin; do mkdir "/var/spool/amavis/$dir"; done
Offline
Why would you use a loop when, like I posted, mkdir supportes multiple directories?
mkdir -p /var/spool/avamis/var /var/spool/avamis/tmp /var/spool/avamis/virusmails /var/spool/avamis/spammassassin
Offline
Hehe because it's less typing!
Offline
Hehe because it's less typing!
Good one!
Also, it's by far the more dynamic method.
"Your beliefs can be like fences that surround you.
You must first see them or you will not even realize that you are not free, simply because you will not see beyond the fences.
They will represent the boundaries of your experience."
SETH / Jane Roberts
Offline
peets wrote:Hehe because it's less typing!
Good one!
Also, it's by far the more dynamic method.
If you want to get pedantic, it's also far less efficient in terms of execution time: each iteration of the loop forks a new process, whereas using a single mkdir command forks only once. The "best" way is the curly-braces method demonstrated above by chimeric.
Offline