-1
pip install sphinx
sphinx-quickstart -q -p DSPackageDocs -a Me -v 1 --ext-autodoc
perl -i -e $'s/#sys.path.insert(0, os.path.abspath(\'.\'))/sys.path.insert(0, os.path.abspath(\'.\/DSPackage\'))/g' conf.py

The 3rd line looks into a file and replaces some text. Specifically, I replace

sys.path.insert(0, os.path.abspath('.')) 

with

sys.path.insert(0, os.path.abspath('./DSPackage'))

This line works perfectly fine in the terminal in the shell script I get the error:

Syntax error: ")" unexpected

Ed Morton
  • 188,023
  • 17
  • 78
  • 185
jtaylor
  • 45
  • 6
  • Do you use the same shell in the terminal and in the script? – choroba Jan 06 '17 at 16:53
  • 1
    Is the first line of the script `#!/bin/sh`? – melpomene Jan 06 '17 at 16:59
  • Which she-bang are you using, specify it explicitly as `bash`, i.e. `#!/bin/bash` – Inian Jan 06 '17 at 17:00
  • Adding #!/bin/sh doesn't change anything. Adding #!/bin/bash still fails that line but also fails my pip install commend. @choroba: I'm new to linux, but I think you are asking if I am running the script in the same terminal that I'm running the command? The answer is yes. – jtaylor Jan 06 '17 at 17:05
  • 1
    I didn't tell you to add `#!/bin/sh`. In fact, it's a potential source of problems, which is why I asked about it. – melpomene Jan 06 '17 at 17:08
  • And no, choroba's question wasn't about terminals. What exactly is in your script file and how exactly are you running it? – melpomene Jan 06 '17 at 17:09
  • Actually #! /bin/bash works! Maybe i typed it incorrectly before! AWESOME! THANKS! – jtaylor Jan 06 '17 at 17:09
  • @EdMorton Where I have perl it was originally sed, I changed it to perl during my troubleshooting, I never realized I didn't change it back to sed. I'm sorry. – jtaylor Jan 07 '17 at 20:26

1 Answers1

1

I'm getting the error if I execute the command in dash. dash doesn't seem to support the $'...' quotes.

It works OK in bash, and emits different errors in zsh and ksh:

Unknown regexp modifier "/D" at -e line 1, at end of line
Unknown regexp modifier "/S" at -e line 1, at end of line
Unknown regexp modifier "/P" at -e line 1, at end of line
Unknown regexp modifier "/k" at -e line 1, at end of line
Can't find string terminator "'" anywhere before EOF at -e line 1.

Make sure to specify the correct shell on the first line of the script

#! /bin/bash

and to call the script correctly:

/path/to/the/script.sh

or

cd /path/to/the
./script.sh
choroba
  • 231,213
  • 25
  • 204
  • 289