【shell】shell 中如何输出 n 个连续字符?

Date: 2018.7.2


1、参考:

https://my.oschina.net/antsky/blog/1800301

2、shell输出n个连续字符
spacenum=`expr 16 - ${#IP}`
spacenum=12
spaces=$(seq -s ' ' $spacenum | sed 's/[0-9]//g')

解析:

  1. ${ }获取一个变量的长度
  2. seq -s ‘a’ 5 输出 1a2a3a4a5a
  3. sed ‘s/[0-9]//g’ 将 0-9 的数字去掉
原文地址:https://www.cnblogs.com/SoaringLee/p/10532427.html