簡體   English   中英

如何讓bash shell輸出帶有顏色的字體?

[英]How to let the bash shell output font with color?

我遇到一些命令輸出問題,例如使用“ 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

輸出的字體顏色消失了。 如何解決?

測試一下:

更換

#!/bin/bash

通過

#!/bin/bash -l

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM