Linux 中echo 的用法

DESCRIPTION
      Echo the STRING(s) to standard output.

     -n   do not output the trailing newline
    输出文字不换行
     -e   enable interpretation of backslash escapes
    将转义符跟后边的特殊字符解释成特殊意义
    -E   disable interpretation of backslash escapes(default)
    不解释转义字符
    --help display this help and exit
    帮助
    --version
               output version information and exit
    显示版本等信息

    If -e is in effect, the following sequences arerecognized:
    当用-e时特殊字符的效果如下
    \\ backslash    显示\
    \a alert (BEL)

    发出警报声
    \b backspace
    删除前一个字符
    \c produce no further output
    最后不加上换行符号
    \e escape
    字符向前退一位
    \f form feed
    换行但光标仍停留在原来的位置
    \n new line
    换行
    \r carriage return
    光标移至行首但不换行
    \t horizontal tab
    水平制表符
    \v vertical tab 
    垂直制表符
    \0NNN byte with octal value NNN (1 to 3 digits)
    八进制代表的ASCII字节
    \xHH byte with hexadecimal value HH (1 to 2 digits)
   十六进制代表的ASCII字节

下面是一个echo的小练习,打印乘法口诀表:

#!/bin/bash
#6.sh
for i in 1 2 3 4 5 6 7 8 9
do 
	for j in 1 2 3 4 5 6 7 8 9
	do
		if [ $j -le $i ]
		then 
		    echo -e "$j\c"
		    echo -e "*\c"
		    echo -e "$i\c"
		    echo -e "=\c"
		    echo -e "$[ $i*$j ] \c"
   		fi
	done
	echo ""
done

运行结果如下;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值