【问题标题】:How to let the bash shell output font with color?如何让 bash shell 输出带颜色的字体?
【发布时间】:2015-03-21 15:14:46
【问题描述】:

我遇到了一些命令输出问题,例如使用 'phpunit' 命令。

我在我的 linux 术语中直接运行 phpunit 命令,并且有一些带有红色/绿色字体颜色的输出。

$>> phpunit --bootstrap src/autoload.php tests/ExampleTestCase.php

但是当我将此命令放入 bash 文件(test.sh)时:

------------test.sh-------------
#!/bin/bash
file=$1
phpunit --bootstrap src/autoload.php $file
-------------------------------

$>> chmod u+x test.sh
$>> ./test.sh

输出字体颜色消失了。如何解决?

【问题讨论】:

    标签: linux bash shell


    【解决方案1】:

    测试一下:

    替换

    #!/bin/bash
    

    通过

    #!/bin/bash -l
    

    【讨论】:

    • 为什么不-i 进行互动?没有理由(我相信也不可取)为脚本使用登录 shell。
    猜你喜欢
    • 2015-04-26
    • 2012-06-17
    • 1970-01-01
    • 2015-11-16
    • 1970-01-01
    • 1970-01-01
    • 2021-04-15
    • 2017-08-19
    • 1970-01-01
    相关资源
    最近更新 更多