社区
基础编程
帖子详情
菜问题:为什么 echo "$string1\n$string2"中的\n不换行
xelibri
2005-01-14 12:33:02
环境:win2000,iis5,php4
...全文
56
2
打赏
收藏
菜问题:为什么 echo "$string1\n$string2"中的\n不换行
环境:win2000,iis5,php4
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xelibri
2005-01-14
打赏
举报
回复
谢谢!
leyan728
2005-01-14
打赏
举报
回复
你看你的源文件,就会发现你的$string1和$string2是换行了的,但是这个\n并不能控制页面现实的换行,页面现实换行请用<br>
${
string
::N}和${
string
:N}字符提取
有文件file,内容为1234567898453613025(n个数字),编写程序实现每隔4个数字就换行。脚本编写如下: ${
string
::N}提取前N个字符,${
string
:N}提取N个之后的字符 # cat ./test.sh #!/bin/bash test=1234567898453613025 num_test=`
echo
${#test}` num=$[num_te
shell
echo
换行
不换行
打印换行
换行与
不换行
echo
默认是有换行的, -n的时候, 是
不换行
的, 看下man的介绍: ubuntu@VM-0-13-ubuntu:~$ man
echo
| grep "\-n" -C2
Echo
the
STRING
(s) to standard output. -n do not output the trailing newline ...
echo
的换行与
不换行
echo
默认是有换行的, -n的时候, 是
不换行
的, 看下man的介绍: ubuntu@VM-0-13-ubuntu:~$ man
echo
| grep "\-n" -C2
Echo
the
STRING
(s) to standard output. -n do not output the trailing newline -e
shell
中
echo
输出换行的方法
echo
要支持同C语言一样的\转义功能,只需要加上参数-e,如下所示:[~]#
echo
"Hello world.\nHello sea"Hello world.\nHello sea[~]#
echo
-e "Hello world.\nHello sea"Hello world.Hello sea[~]#不加-e看一下man的说明:[~]#man
echo
| cat
ECHO
(1) ...
怎么让
echo
不换行
怎么让
echo
不换行
呢?如下方法便可以:
echo
-e "zonghzha\c" >> test
echo
-e "zonghzha" >> test cat test发现内容为: zonghzhazonghzha 以下内容均参考自:https://www.cnblogs.com/my-ShowTime/p/5420555.html
echo
-e "...
基础编程
21,893
社区成员
140,347
社区内容
发帖
与我相关
我的任务
基础编程
从PHP安装配置,PHP入门,PHP基础到PHP应用
复制链接
扫一扫
分享
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章