[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Edlug Archive Jan 2004 ]

Re: [edlug] bash script help needed




if your mkdir is a recent GNU version you can do this:


---
MYDIR = ~user/dir
mkdir -p $MYDIR/some/other/dir
---

but don't foget to check all your exit values. :-)

> if !exists some/dir
>    mkdir some/dir
> endif (if needed)

[ ! -d some/dir ] && mkdir -p some/dir



Yours
Faye

This time she's the lesser of two evils.

http://www.morpheux.org





David Marsh's listreading hat wrote:

I'm not much of a scripting expert and was wondering if somebody could tell me how to do the following in bash?


(good old pseudocode)



MYDIR = ~user/dir mkdir $MYDIR/some/other/dir


(I'm not sure what the right syntax for this is, and I don't seem to have it right)


(and also)


if !exists some/dir
   mkdir some/dir
endif (if needed)


Thanks for any advice,



David. - ---------------------------------------------------------------------- You can find the EdLUG mailing list FAQ list at: http://www.edlug.org.uk/list_faq.html

-
----------------------------------------------------------------------
You can find the EdLUG mailing list FAQ list at:
http://www.edlug.org.uk/list_faq.html



This archive is kept by wibble@morpheux.org.DONTSPAMME
homepage