The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-27-2008
ccox85 ccox85 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 27
Use awk to create new folder in current directory

Alright, I am sure this is a laughable question, but I don't know so I am going to ask anyway.

I have a little script I am writing to take information from one source, recode it in a certain way, and print to files for each subject I have data for. This all works perfectly. I just want to put a little icing on the cake if you will and make is so no matter where I run the script, or on what computer, it will always send all of the output to a new folder in the current directory.

To be more specific. Lets say I am running the script in /home/research/.
Instead of sending the output to the current directory proper, I want to create a new folder to stuff it all in, so it is not intermingled with my other files. I travel a lot, so if I hardcode " > "iat_exp/" et "_" sn ".out", I get an error if the folder iat_exp does not exist yet.

So, I want my awk script to create that folder when it starts running.

I hope this is enough detail... I am an inexperienced scripter and am just using awk in cygwin on my xp laptop, although I am setting up my first Ubuntu box, so I am pretty excited about that.

Thanks all,
Chris