nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

make directory

This is a discussion on make directory within the Shell scripting forums, part of the Development/Scripting category; I am currently working on a PL file. where i encounter some errors. I am trying to create a dir ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-18-2005, 07:38 AM
wk3000sg
Guest
 
Posts: n/a
Default make directory

I am currently working on a PL file. where i encounter some errors.

I am trying to create a dir if it is not available :
########################

22 FILEPATH = '/trs/wg/'.$ToDate.'/';
23 print "Filepath is $FILEPATH\n";
24 #CURDIR = $FILEPATH;
25 if [ ! -d $FILEPATH ];
26 then
27 mkdir $FILEPATH
28 fi

########################
The error was :
Can't modify constant item in scalar assignment at printfile.pl line 22, near "'
/';"
syntax error at printfile.pl line 25, near "if ["
Semicolon seems to be missing at printfile.pl line 27.
printfile.pl had compilation errors.

Anyone can help me?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-18-2005, 01:43 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 556
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

I'm not perl expert but it looks like you have mixed shell scripting with perl code.

Okay first try to replace line 22
Code:
22 FILEPATH = '/trs/wg/'.$ToDate.'/';
with
Code:
FILEPATH = "/trs/wg/".$ToDate."/";
and then if command as follows:
Code:
25 if [ ! -d $FILEPATH ];
26 then
27 mkdir $FILEPATH
28 fi
with
Code:
if ( ! -d $FILEPATH  ){
  mkdir($FILEPATH, 0755) || die "Cannot mkdir newdir: $!";
}
Since file extension is .pl (perl) and code seems like perl I'm assumed that it is perl code. If you wanna shell script code then it again need to modify
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 08-18-2005, 05:41 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 901
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Indeed it is perl code mixed with shell scripting.
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
make 2.6.22 as 2.6.18 image.. sathiya Ubuntu / Debian 1 05-02-2008 02:03 AM
How to make leafpad to print satimis Linux software 0 12-25-2007 07:36 PM
error while using make in aix linuxnightowl84 Coding in General 0 04-18-2007 11:23 AM
How do I make an initrd image? jerry Linux software 2 12-16-2005 07:32 PM
How do I make backup of ISO CD sweta Solaris/OpenSolaris 1 09-09-2005 05:29 PM


All times are GMT +5.5. The time now is 06:46 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36