linux学习基本练习--echo/printf用法

本文详细介绍了Shell内置命令echo和printf的功能及使用方法,并演示了如何利用这些命令将指定文本分为两行显示。此外,还简要介绍了file命令的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、echo是内部命令还是外部命令?其作用是什么?如何显示“the year is 2016.Today is 10yue 26”为两行?


通过type命令可知echo是内部命令:

[root@xuelinux ~]# type echo

echo is a shell builtin

echo作用:直接显示输入的内容。

echo -e "the year is 2016. \n today is 7."

[root@xuelinux ~]# echo -e "The year is 2016. \nToday is 7."

The year is 2016. 

Today is 7.


2、printf是内部命令还是外部命令?其作用是什么?如何显示“the year is 2016.Today is 10yue 26”为两行?

通过type命令可知printf是内部命令:

[root@xuelinux ~]# type printf

printf is a shell builtin

printf作用:格式并显示输入的内容。

printf "the year is 2016. \n today is 7."

[root@xuelinux ~]# printf "The year is 2016.Today is 7.\n"

The year is 2016.Today is 7.

[root@xuelinux ~]# 


3、file命令使用及用法

man file  determine file type  确定文件类型

eg: file /bin/ls

file 绝对路径















本文转自wang650108151CTO博客,原文链接:http://blog.51cto.com/woyaoxuelinux/1859079 ,如需转载请自行联系原作者



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值