0
read -d '' PATCH_OS <<EOF

//PATCH//TEXT//

EOF

patch -b < ${PATCH_OS}

This fails:

./script.sh: line 39: --- //PATCH//TEXT//

(line 39 is "patch -b < ${PATCH_OS}"")

0

That's not how redirections work. < redirects input from a file; if you specify a variable then its contents are taken to be the file name. You'd be looking for <<< instead. And don't forget to put quotes around the "$variable", otherwise bash will split its value by spaces.

(Except in your example script the variable is useless. Just use patch -b <<EOF directly.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.