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 UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 08-15-2007
mjays mjays is offline
Registered User
 

Join Date: Apr 2007
Location: london
Posts: 40
i've now changed the code and it works fine.

Code:
if (! -d "$logdir") {
    use File::Path;
    eval { mkpath($logdir) };
    if ($@) {
        print "\nERROR: release log directory creation failed - $logdir: $!\n";
        exit;
    }
i've just started learrning perl and i'm slowly discovering that it makes things harder and longer. in unix i would have done this in one line.

Code:
[ -d ${LOGDIR} ] || mkdir -p ${LOGDIR} || { echo "\nERROR: release log directory creation failed - ${LOGDIR}"; exit 1; }
thank you cbkihong.
Reply With Quote