bash – 在Fish Shell中设置导出

我安装了多个版本的 PHP,对于我的正常开发,我总是使用通过homebrew安装的PHP 5.5.x.

在鱼壳里

which PHP & PHP --version
=> /usr/local/bin/PHP
=> PHP 5.5.8 (cli) (built: Jan 16 2014 15:58:25)

路径是正确的.

我的问题是,当我必须使用Drupal进行开发时,我使用MAMP作为捆绑灯堆,并且MAMP包含自己的PHP版本.我的问题是,当Drush与Drupal一起使用时,我不能像往常一样在bash中设置PHP可执行文件路径.我只想要使用捆绑的PHP版本/可执行文件.

在bash我可以这样做:

# Set Drush root to MAMP PHP
export Drush_PHP=/Applications/MAMP/bin/PHP/PHP5.5.3/bin/PHP

但这不适用于鱼壳,我试过这个(没有成功):

fish配置位置:〜/ .config / fish / config.fish

set -x Drush_PHP=/Applications/MAMP/bin/PHP/PHP5.5.3/bin/PHP

如果我用drush statusi运行fishshell总是得到这个:

Drupal version         :  7.26
 Site URI               :  http://default
 Database driver        :  MysqL
 Database username      :  root
 Database name          :  dev-db
 Default theme          :  garland
 Administration theme   :  garland
 PHP executable         :  /usr/local/bin/PHP
 PHP configuration      :  /usr/local/etc/PHP/5.5/PHP.ini
 PHP OS                 :  Darwin
 Drush version          :  6.2.0
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Applications/MAMP/htdocs/SandBox/dev
 Site path              :  sites/default
 File directory path    :  sites/default/files

当我在bourne shell中运行相同的命令时,我得到了正确的设置:

Drupal version                  :  7.26                                        
  Site URI                        :  http://default                              
  Database driver                 :  MysqL                                       
  Database username               :  root                                        
  Database name                   :  dev-db                                      
  Database                        :  Connected                                   
  Drupal bootstrap                :  Successful                                  
  Drupal user                     :  Anonymous                                   
  Default theme                   :  bartik                                      
  Administration theme            :  seven                                       
  PHP executable                  :  /Applications/MAMP/bin/PHP/PHP5.5.3/bin/PHP 
  PHP configuration               :  /Applications/MAMP/bin/PHP/PHP5.5.3/conf/PHP.ini                                       
  PHP OS                          :  Darwin                                      
  Drush version                   :  6.2.0                                       
  Drush configuration             :                                              
  Drush alias files               :                                              
  Drupal root                     :  /Applications/MAMP/htdocs/SandBox/dev       
  Site path                       :  sites/default                               
  File directory path             :  sites/default/files                         
  Temporary file directory path   :  /Applications/MAMP/tmp/PHP

那么,如何设置鱼的Drush_PHP的导出路径?

如果您想在fish shell中模拟导出命令,只需创建以下文件

〜/的.config /鱼/功能/ export.fish

function export
    if [ $argv ] 
        set var (echo $argv | cut -f1 -d=)
        set val (echo $argv | cut -f2 -d=)
        set -g -x $var $val
    else
        echo 'export var=value'
    end
end

启动一个新终端,然后按预期从您的fish shell运行导出:

export foo=123
echo $foo

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...