在Bash中,试过这个:
echo -e "hello\nworld"
Run Code Online (Sandbox Code Playgroud)
但它不会仅打印换行符\n.如何让它打印换行符?
我正在使用Ubuntu 11.04.
我正在尝试使用echo命令在终端中打印文本.
我想以红色打印文本.我怎样才能做到这一点?
我想使用以下内容将一些预定义的文本写入文件:
text="this is line one\n
this is line two\n
this is line three"
echo -e $text > filename
Run Code Online (Sandbox Code Playgroud)
我期待这样的事情:
this is line one
this is line two
this is line three
Run Code Online (Sandbox Code Playgroud)
但得到了这个:
this is line one
this is line two
this is line three
Run Code Online (Sandbox Code Playgroud)
我很肯定每个人都没有空间\n,但额外的空间是如何产生的?
如何使用bash脚本回显一个或多个制表符?当我运行此代码时
res=' 'x # res = "\t\tx"
echo '['$res']' # expect [\t\tx]
Run Code Online (Sandbox Code Playgroud)
我明白了
res=[ x] # that is [<space>x]
Run Code Online (Sandbox Code Playgroud) 我有一个运行带参数的程序的bash脚本.该程序输出一些状态(这样做,这样做......).这个程序没有选择安静.如何防止脚本显示任何内容?
我正在寻找类似windows"echo off"的东西.
我正在编写一个Bash脚本,可以在屏幕上打印一些文本:
echo "Some Text"
Run Code Online (Sandbox Code Playgroud)
我可以格式化文本吗?我想大胆一点.
PHP print和echo?有什么区别?
Stack Overflow有很多关于PHP print和echo关键字使用的问题.
这篇文章的目的是提供 关于PHP 和关键字的规范参考问题和答案print,echo并比较它们的差异和用例.
我刚刚遇到了来自3v4l的一小段PHP代码:https://3v4l.org/jmrZB
echo 1...1; //10.1
Run Code Online (Sandbox Code Playgroud)
而且我担心我不知道如何解释其结果.为什么这被认为是有效的?