I want to do this --

function swap(){ mv $1 $1._tmp && mv $2 $1 && mv $1._tmp $2; }
function alterpdf(){ swap(titlepage_$1.tex titlepage_$2.tex); swap(titlepage_$1.pdf,titlepage_$2.pdf); pdflatex allTitle    page.tex; }  

My swap function works well. Now , I want to use the swap function inside the alterpdf function. But, this produces error --

enter image description here

  • How do you use the swap function when it works well? – ilkkachu Mar 18 '18 at 10:58
  • 2
    Please don't post screenshots of terminal error messages, just post the text - it's simple to do in the type of gui terminal emulator program that you're using. – user1404316 Mar 18 '18 at 11:18
  • @ilkkachu $swap file1 file2 – alhelal Mar 18 '18 at 13:17

Why are you putting shell function parameters inside parentheses? Try this:

function alterpdf(){
  swap titlepage_$1.tex titlepage_$2.tex
  swap titlepage_$1.pdf titlepage_$2.pdf
  pdflatex allTitle page.tex

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.