Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
After installing Drush I get this error:
melissa/bin/drush/drush: syntax error at line 9: `ORIGDIR=$' unexpected
Comment | File | Size | Author |
---|---|---|---|
#24 | drush-24.patch | 3.45 KB | greg.1.anderson |
#20 | drush-20.patch | 3.07 KB | greg.1.anderson |
#19 | drush-19.patch | 2.9 KB | greg.1.anderson |
#17 | drush-17.patch | 2.9 KB | greg.1.anderson |
#15 | drush-with-non-posix.patch | 2.83 KB | greg.1.anderson |
Comments
Comment #1
greg.1.anderson CreditAttribution: greg.1.anderson commentedThat's hard to say. Try changing the first line of the drush script to:
It that doesn't help, we'll need more info on your setup.
Comment #2
Melissamcewen CreditAttribution: Melissamcewen commentedSo this server admin informs me that "Our php cli version is too old for the newest version of drush." So if anyone else has this problem, it's probably caused be that.
Comment #3
greg.1.anderson CreditAttribution: greg.1.anderson commentedDrush will run on php 5.2; your problem is happening before php is executed.
Try running php + drush.php directly:
/path/to/php /path/to/drush/drush.php --php=/path/to/php status
Also,
php -version
to determine that you have at least php 5.2.Comment #4
d.walter CreditAttribution: d.walter commentedI am having exactly the same problem. I can't run Drush because of this. Neither of the solutions suggested here worked for me. I tried 7.x-4.5 as well as 7.x-5.0-rc2 and get the same error code for both.
Can anybody help? Thank you.
[I hope it is OK to reopen this. I am new here, my apologies if I am doing something wrong.]
Comment #5
greg.1.anderson CreditAttribution: greg.1.anderson commentedSure, reopening is fine. Drush is failing on the first line of the bash script, which probably means that you are running it with some shell other than bash. Did you try the change suggested in #1? How about #3?
Comment #6
d.walter CreditAttribution: d.walter commentedThank you for the reply. Yes, I followed both suggestions literally: neither solved the problem.
"which probably means that you are running it with some shell other than bash"
I am afraid I have no idea what that means. I followed the manual installation instructions because I could not get the recommended installation process (using pear) to work either. I also had problems creating the symbolic link there. But in the end it seems I could start Drush, only it fails with the error message quoted by the original poster.
Is there anything I can do to find out what the problem is?
Thank you!
Comment #7
greg.1.anderson CreditAttribution: greg.1.anderson commentedDrush requires bash (or, on Windows, Powershell, DOS or Msysgit). I'm sorry that I cannot debug your environment or tell you what you are running.
Comment #8
d.walter CreditAttribution: d.walter commentedIt seems I can actually run Bash (v. 3.2), but even using that Drush still fails with the same error code. I am giving it up. Thank you for taking the time to reply.
Comment #10
LuCarD CreditAttribution: LuCarD commentedI am re-opening this ticket... With some additional information and possible fixes.
This happens on system which have non-POSIX-compatible bourne-shells. These systems don't support the $( ) for commands and only support the ` ` option. There are still live systems which are being released with this kind of shell. ( for example SunOS, this might be configuration setting ).
The simple way to solve this is by using ` ` instead of $( ).
Small note: PEAR is also using ` ` in their shell script.
Comment #11
laurentchardin CreditAttribution: laurentchardin commented+1 on what LuCarD is reporting.
I am currently testing the drush script on Solaris (SunOS 5.10) and having the same issue.
On solaris, i had to switch /bin/sh to /bin/bash to make it work.
Comment #12
greg.1.anderson CreditAttribution: greg.1.anderson commentedWe could fix this with ``, as suggested in #10, but if it would also work for most folks to switch from /bin/sh to /bin/bash, I would prefer to do that. Any opinions on that? bash is available on Linux, BSD, SunOS; maybe it is prevalent enough to depend on.
Comment #13
greg.1.anderson CreditAttribution: greg.1.anderson commentedSee also #1659014: Use a POSIX shell instead of bash and small fix for incorrect shells
Comment #14
greg.1.anderson CreditAttribution: greg.1.anderson commentedSee also #1706496: Drush script does not need to save/restore pwd
Comment #15
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is a patch that switches from $() to ``, and also fixes issues identified in the issues linked to in #13 and #14. Works fine on Linux; would be nice to have feedback from Solaris, Mac and Windows users.
Comment #16
laurentchardin CreditAttribution: laurentchardin commentedI will test this patch and give you a feedback on Solaris.
But there is something that does not work for sure on Solaris is:
which php-cli will always return 0, even if php-cli does not exists.
A workaround would be to use 'whereis' or 'type' instead of 'which'.
I don't know which one is the most supported. Or have a special case (huh!) for solaris.
Comment #17
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is a new version that addresses
which php-cli
per #16.Comment #18
laurentchardin CreditAttribution: laurentchardin commentedAbout #17 on Solaris.
First thing i change locally: for solaris guys, they need to be sure to put /usr/xpg4/bin in their PATH before /usr/bin.
A more POSIX compliant shell will be used instead of the default one. And that way, i didn't need to change the shebang to bash anymore.
Next, on the PHPCLI, the trick didn't make it, since Solaris has the pleasant idea to actually display a message:
So the message gets stored in the variable.
I remember reading somewhere that the POSIX way would be to test: php-cli -v and check for return code > 0. (Should be 127 in this case).
This could look like:
this will fail if anybody use the -e flag on the shebang however.
The trick works for me so far, changed over the #17 patch.
One last thing, Solaris does not support unified patch, and i don't have the GNU version on the server i'm working on (no root access).
Had to modify it by hand, that was fun.
Thank you
Comment #19
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is a version that uses php-cli -v. Still working okay on Linux.
Comment #20
greg.1.anderson CreditAttribution: greg.1.anderson commentedTested on Windows with msysgit, and found to be working (once a couple minor adjustments were made, attached).
So, now works on Linux, Windows, and (presumably) Solaris. Needs Mac testing. Should be committed after Drush-5.7 is released, so it has some time to live in dev before going into a stable release.
Comment #21
greg.1.anderson CreditAttribution: greg.1.anderson commentedFixing category; not a support request.
Comment #22
laurentchardin CreditAttribution: laurentchardin commentedGreg, i don't see you have integrated 'php-cli -v' check or #19 nor 20. Did you remove it ?
Comment #23
greg.1.anderson CreditAttribution: greg.1.anderson commentedWrong patch in #20. :p
Comment #24
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is the right one.
Comment #25
laurentchardin CreditAttribution: laurentchardin commentedSo far so good. script is ok for me on solaris (10) and macosx.
To sum up, for solaris, adding /usr/xpg4/bin in the $PATH before any others is mandatory (so that the posix compliant shell is used).
Comment #26
greg.1.anderson CreditAttribution: greg.1.anderson commentedDrush 5.7 has been released, so committed this to master. Please re-open if any problems are discovered.
Comment #28
LuCarD CreditAttribution: LuCarD commentedThis patch is in the master repository but not in the release on the drupal site or pear ?
Comment #29
greg.1.anderson CreditAttribution: greg.1.anderson commentedThis will be in Drush 5.8.