سؤال

Open ended question (be creative!) for a real use case. Essentially I want to cat (1) an existing file (2) the output of a program and (3) a specific bit of text. Between pipes, echo and redirects, I feel like I should be able to do better than this!

pandoc -t latex -o mydoc.tex mydoc.rst
echo \\end{document} > footer.tex
cat header.tex mydoc.tex footer.tex > fulldoc.tex
هل كانت مفيدة؟

المحلول

{
  cat header.tex
  pandoc -t latex mydoc.rst
  echo \\end{document}
} > fulldoc.tex

نصائح أخرى

If you're using bash, you can use process substitution and a here string:

cat header.tex <(pandoc -t latex mydoc.rst) <<<'\end{document}' > fulldoc.tex
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top