Results 1 to 3 of 3
Hi
I’m running a expect script to save config files.
I want the script to check if a directory exist and if not create it.
Anyone who knows how to ...
- 09-25-2008 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 2
Expect Script
Hi
I’m running a expect script to save config files.
I want the script to check if a directory exist and if not create it.
Anyone who knows how to do that?
- 09-25-2008 #2
i usually do the following:
mkdir -p /home/mydir/whatever
The breakdown of this is that i really dont care if it already exists, i just want to make sure it exists when my command is done. The '-p' will make all necessary directories (including parents) to insure that it exists and will remain silent if they are already existing. So for example, if i dont have either 'mydir' or 'whatever' then it will create both. If i have 'mydir', but not 'whatever' then it will create only the one. If i have both, then it will remain silent and return.
- 09-26-2008 #3Just Joined!
- Join Date
- Sep 2008
- Posts
- 2
Thank you very much, it works.


Reply With Quote