Help with copying from one drive to another with cgi & ksh script

Hi I was hoping some one could help me with a problem I have with a .cgi script I am running in the korn shell.
I have created a web form that user fill out to gather information that I use a .cgi and sed script to translate into a xml file which is further processed by another program.

All is well except for one final glitch, the .cgi script I am using will not copy the final .xml file to its final destination on another disk on our network.
I can copy the files to their final network location if I open another shell without a problem - just the current shell that is running the cgi refuse to do so.
I have tried every way around this I know and I still can not get the current shell running the .cgi script to do as I have asked.
If any one has a suggestion that I could try I would be very thankful for your help as I am at my wits end.
Below Is some of the relevant code I am using

#!/bin/ksh
NOW=$(date +"%Y-%m-%d-%HH-%MM-%SS")
print "Content-type: text/plain\r\n\r"
print "my query string from (GET) is \"$QUERY_STRING\"" | cat > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
print "\nWorking..."
cat
sed -i '' -e s'/.*\"Section0Begin/Section0Begin/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/JobName\=/JobName\=\$\"/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/&Section0End/"&Section0End/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/\(\&Section[0-9]End\=Section[0-9]End\&\)/\1\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
and on and on...

Below is the line of code that I just cant seem to make work.

cp /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/XML-Library/$NOW-Sec00.xml  /Volumes/AraxiVolume_HW07376_J/Jobs/funnel_Create_Job_Impo/HotFolders/Funnel_CreateImpos_05_22_18/$NOW-Sec00.xml
 

I would be very grateful for any assistance you can provide.

If your target really contains a <newline> character, enclose it in double quotes.

1 Like

Hi thank you for the advice. I am not sure if I am understanding correctly what you mean I don't believe there are any newline characters contained in the target.

/Volumes/AraxiVolume_HW07376_J/Jobs/funnel_Create_Job_Impo/HotFolders/Funnel_CreateImpos_05_22_18/$NOW-Sec00.xml

Something does seem not quite right though when I try to copy with the $NOW variable included in the file name I am unable to do so even under the same directory, could the $NOW variable have a time limit on it since it is based on the current time?
I have included the rest of the code for the script the end product is 4 .xml files
Is there a different set of permissions on the ksh?

#!/bin/ksh
NOW=$(date +"%Y-%m-%d-%HH-%MM-%SS")
print "Content-type: text/plain\r\n\r"
print "my query string from (GET) is \"$QUERY_STRING\"" | cat > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
print "\nWorking..."
cat

sed -i '' -e s'/.*\"Section0Begin/Section0Begin/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/JobName\=/JobName\=\$\"/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/&Section0End/"&Section0End/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/\(\&Section[0-9]End\=Section[0-9]End\&\)/\1\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e s'/.*\&Description[0-9]\=\&PartNo[0-9].*//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/.*\&templates[0-9]\=\&Pagelist[0-9]\=.*//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/.*\&Pagelist[0-9]\=\&Section[0-9]End.*//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^\s*$/d' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/&/\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^\s*$/d' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/templates[0-9]*=x[0-9]*[.]*[0-9]*_/\<FinalWidth\>&\<\/FinalWidth\>\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/^y[0-9]*[.]*[0-9]*_/\<FinalHieght\>&\<\/FinalHieght\>\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/^x[0-9]*[.]*[0-9]*_/\<Stockwidth\>&\<\/Stockwidth\>\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/^y[0-9]*[.]*[0-9]*_/\<StockHieght\>&\<\/StockHieght\>\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/^[0-9]*sd_/\<Sides\>&\<\/Sides\>\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/^[a-b]_/\<BackUp\>&\<\/BackUp\>\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/^[0-9]*u/\<NumUp\>&\<\/NumUp\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/u\<\/NumUp\>/\<\/NumUp\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/\>templates[0-9]*\=x/\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/_\<\//\<\//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/\>y/\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/\>x/\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e '/^PartNo.*/,/^Pagelist.*/ s/sd\<\//\<\//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e s'/JobName[0-9]\=/\<JobName\>\$JobName\<\/JobName\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e s'/\(Description[0-9]*\=.*\)/<Description\>&\<\/Description\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/Description[0-9]*\=//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e s'/\(Pagelist[0-9]*\=.*\)/<RunLength\>&\<\/RunLength\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/Pagelist[0-9]*\=//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e s'/\(PartNo[0-9]*\=.*\)/<PartNo\>&\<\/PartNo\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/PartNo[0-9]*\=//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

sed -i '' -e s'/\([A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*.*\)/\1placeholder\1/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
sed -i '' -e s'/placeholder/\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW

sed -i '' -e '3 s/\([A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*\).*/\1/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

grep ^[A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*$ /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW | awk '{print int(($1/200)-0.0001)*200+1}' > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
grep ^[A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*$ /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW | awk '{print int(($1/200)+0.999)*200}' >> /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
chmod 777 /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e '1 s/\(.*\)/\1\-/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e s'/\ //g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group 
sed -i '' -e '1 s/\(.*\)/\<Group\>\1\<\/Group\>/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group

grep ^[A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*$ /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW  >> /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e s'/\(^[A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*$\)/\<JobNumber\>\1\<\/JobNumber\>/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
grep "JobName\=\$\.*" /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW  >> /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e s'/JobName\=\$//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e s'/\"//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group

sed -i '' -e s'/\(^[A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*.*\)/\1PLACEHOLDER\1/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e s'/PLACEHOLDER/\'$'\n/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e'3 s/\-\%28Offline\-Archived\%29//' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e'4 s/.*\(\-\%28Offline\-Archived\%29\)/\1/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e'4 s/^[A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*.*//' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e'4 s/.*\(\-\%28Offline\-Archived\%29\)/\1/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group

sed -i '' -e'4 s/\-\%28Offline\-//' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e'4 s/\%29//' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e'4 s/.*\(^.*$\).*/\<Archived\>\1\<\/Archived\>/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group
sed -i '' -e'3 s/.*\(^.*$\).*/\<JobName\>\1\<\/JobName\>/' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Group

sed -i '' -e '/Section[0-9]*Begin\=Section[0-9]*Begin/ r /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/'$NOW'-Group' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
sed -i '' -e s'/.*\>\$JobName\<.*//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/.*JobName\=\$\".*//g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
sed -i '' -e s'/^[A-Z]*[a-z]*[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*$//' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
sed -i '' -e '/^\s*$/d' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 

if grep -q "[D][0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*_" /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
then
    sed -i '' -e s'/\<Group\>1\-0\<\/Group\>/\<Group\>DSF\-PREPRESS<\/Group\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
fi

if grep -q "[0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*_" /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
then
    sed -i '' -e s'/\<Group\>1\-0\<\/Group\>/\<Group\>Studio<\/Group\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
fi

if grep -q "[T][0-9]*[0-9][0-9][0-9][0-9][0-9][A-Z]*[a-z]*[0-9]*_" /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW
then
    sed -i '' -e s'/\<Group\>1\-0\<\/Group\>/\<Group\>ClientsTest<\/Group\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW 
fi

sed -i '' -e s'/\(^Section[0-9].*\)/\<\!--\ \1\ --\>/g' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW

sed -n -e '/.*Section0Begin\=Section0Begin.*/,/.*Section0EndSection0End\=Section0End.*/p' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec0
chmod 777 /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec0
sed  -e '/\<Job\>/ r /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/'$NOW'-Sec0' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/StandingXML > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/$NOW-Sec00.xml

sed -n -e '/.*Section1Begin\=Section1Begin.*/,/.*Section1End\=Section1End.*/p' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec1
chmod 777 /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec1
sed  -e '/\<Job\>/ r /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/'$NOW'-Sec1' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/StandingXML > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/$NOW-Sec11.xml


sed -n -e '/.*Section2Begin\=Section2Begin.*/,/.*Section2End\=Section2End.*/p' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec2
chmod 777 /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec2
sed  -e '/\<Job\>/ r /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/'$NOW'-Sec2' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/StandingXML > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/$NOW-Sec22.xml

sed -n -e '/.*Section3Begin\=Section3Begin.*/,/.*Section3End\=Section3End.*/p' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec3
chmod 777 /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW-Sec3
sed  -e '/\<Job\>/ r /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/'$NOW'-Sec3' /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/StandingXML > /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/$NOW-Sec33.xml

mv /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/$NOW*.xml /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/XML-Library/ 

cp /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/XML-Library/$NOW-Sec00.xml  /Volumes/AraxiVolume_HW07376_J/Jobs/funnel_Create_Job_Impo/HotFolders/Funnel_CreateImpos_05_22_18/$NOW-Sec00.xml
cp /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/XML-Library/$NOW-Sec11.xml  /Volumes/AraxiVolume_HW07376_J/Jobs/funnel_Create_Job_Impo/HotFolders/Funnel_CreateImpos_05_22_18/$NOW-Sec11.xml
cp /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/XML-Library/$NOW-Sec22.xml  /Volumes/AraxiVolume_HW07376_J/Jobs/funnel_Create_Job_Impo/HotFolders/Funnel_CreateImpos_05_22_18/$NOW-Sec22.xml
cp /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/XML-Library/$NOW-Sec33.xml  /Volumes/AraxiVolume_HW07376_J/Jobs/funnel_Create_Job_Impo/HotFolders/Funnel_CreateImpos_05_22_18/$NOW-Sec33.xml

rm /Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca/Workspace/$NOW*

Thank you

The way you posted it made me think of <newline> chars.

Usage of cp and the host part missing in the target path lends itself to the assumption you have NFS exports mounted? Sure it's correctly mounted?

Would be helpful to see the $NOW variable, no? There's definitely no time limit on variables. Perhaps there are no files with $NOW?

That script is overly complicated and impossible to read and digest.

  • Don't run several sed scripts repeatedly on identical files - make that one script. What are those double single quotes for?
  • Don't use lengthy path names - put those into punchy variables.
  • Don't pipe text into cat with a redirected stdout - redirect immediately. What is that single lonely cat for?

Definitely not. Permissions are OS / file system features, not shells'.

1 Like

Thanks v

---------- Post updated at 12:02 PM ---------- Previous update was at 11:45 AM ----------

Hi thank you for your advice below is an example of the $NOW variable

2018-07-03-10H-34M-40S

Yes I am using an a nsf mount.
When I open another shell and I can copy these files around the network but not from within the current ksh shell.
I even had a hard time getting the files to move to their final home under their current directory.

I will take your suggestions and clean up the script and get back to you with the results.
Thanks again!

---------- Post updated at 12:05 PM ---------- Previous update was at 12:02 PM ----------

Oh almost forgot, the double single quotes work with the i option for sed, they force it to not create a bak file.

---------- Post updated at 04:16 PM ---------- Previous update was at 12:05 PM ----------

Hi I made the changes you suggested but still I had little luck.
I created variables for the paths and used a command substitution that copies from one drive to the other and used echo to read everything into a bash shell which finally gave me what I needed

PrinergyHomeVar="/Library/Server/Web/Data/Sites/PrinergyHome.tigroup.ca"
AraxiFunelVar="/Volumes/AraxiVolume_HW07376_J/Jobs/funnel_Create_Job_Impo/HotFolders/Funnel_CreateImpos_05_22_18"
CopyXmlVar=$(cp '$PrinergyHomeVar'/XML-Library/'$NOW'*.xml  '$AraxiFunelVar')

 
echo CopyXmlVar | bash

Thank you for your assistance again

I'd be quite surprised if above worked. cp doesn't output to stdout, so the "command substitution" ( WHY used here?) doesn't deliver anything, and thus the CopyXmlVar will remain empty and can't execute anything in bash .

1 Like

Hi I thought echo would just return the expanded variable and I would pipe it to bash.
maybe I was just lucky but it seems to be working

Everything I tried within the ksh just would not cooperate. I dont know if it was because I am working on a mac or It is something particular to the ksh.
It would be nice to know why it wouldn't cooperate within the ksh but its working now.
Thank you again for all help I could never do this with out you fellows at Unix.com assistance.