I wrote a shell script which automatically set up environment
#!/bin/sh
set path=(/dv/project/ $path)
I change the execution bit by
chmod +x init.sh
When I run it as
./init.sh
It prompted me with error
./init.sh: line 3: syntax error near unexpected token `('
./init.sh: line 3: `set path=(/dv/project/ $path)'
What could be the problem here? Thanks!
set path=? What kind of syntax is that? What is it supposed to do? Where did you see documentation that made you think it's valid?setis a valid command, as I know. It's used for setting up an environment options.set -- path=foowould be valid (setting$1to"path=foo"), but that's not what was given.#!/bin/shmeans your shell is POSIX sh, which has no array support.