简体   繁体   中英

can't run php shell script from symlink

I'm using Acquia's DevDesktop on Windows 10. For a shell, I'm using babun's zsh. Acquia provides the drush command line interface to Drupal.

The command itself seems okay:

{ drush }  » pwd                                                                                /cygdrive/c/Program Files (x86)/DevDesktop/tools/vendor/drush/drush 
{ drush }  » ./drush                                                                            /cygdrive/c/Program Files (x86)/DevDesktop/tools/vendor/drush/drush 
Execute a drush command. Run `drush help [command]` to view command-specific help.  Run `drush topic` to read even more documentation.
...

I created a symlink for it, but it doesn't work:

{ drush }  »  ls -lha /home/username/bin/drush                                                    /cygdrive/c/Program Files (x86)/DevDesktop/tools/vendor/drush/drush
lrwxrwxrwx 1 username None 73 Aug  1 23:29 /home/username/bin/drush -> '/cygdrive/c/Program Files (x86)/DevDesktop/tools/vendor/drush/drush/drush'

{ drush }  » cd ~                                                                                 /cygdrive/c/Program Files (x86)/DevDesktop/tools/vendor/drush/drush
{ ~ } master »                                                                                                                                              
{ ~ } master » drush                                                                                                                                               
Could not open input file: /home/username/bin/drush

I tried changing the permissions, and ensuring line endings are correct, as per this answer , but it still doesn't work.

{ ~ } master » chmod 775 /home/username/bin/drush   
{ ~ } master » dos2unix -F /home/username/bin/drush                                                                                                               
dos2unix: converting file /home/username/bin/drush to Unix format...
{ ~ } master » drush                                                                                                                                               
Could not open input file: /home/username/bin/drush

What am I doing wrong?

我的经验是,php 命令行解释器无法在符号链接下找到脚本,即使 linux/windows bash 路径适合并且您可以轻松地“ cd ”到它,因为它会自动在内部进行符号链接翻译,当您这样做时,从符号链接原始位置对它的相对引用不再存在(意味着相对于符号链接原点的“真实位置”)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM