I'm trying to create a .sh
file which internally runs a patch. So instead of running patch -p0
of a patch file adjacent to the script, I'd like the patch to be embedded within.
I tried the below
patch -p0 <<EOF
Index: app/code/Magento/CustomerImportExport/Model/Import/Customer.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/code/Magento/CustomerImportExport/Model/Import/Customer.php (date 1487543450000)
+++ app/code/Magento/CustomerImportExport/Model/Import/Customer.php (revision )
@@ -371,6 +371,7 @@
// attribute values
foreach (array_intersect_key($rowData, $this->_attributes) as $attributeCode => $value) {
if ($newCustomer && !strlen($value)) {
+ $entityRow[$attributeCode] = $value;
continue;
}
EOF
But it's not working. However when I run patch -p0
on the original patch file, it works without any problems. Any clues what could be wrong?
Thanks,
Try this suggestion from: Re: [bug-patch] patch 2.6.1 with here document in a shell script
Change the above to this, and it will work better:
patch -p0 <<'EOF'
Without the quotes, your script below expands constructs like $@ in the here script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With