加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Bash中的空白连接

发布时间:2020-12-16 01:35:22 所属栏目:安全 来源:网络整理
导读:问题很简单. for i in `seq $begin $progress_length` ; do progress_bar=$progress_bar'#'donefor i in `seq $middle $end` ; do empty_space=$empty_space' 'done 我需要empty_space来在进度条之后定位内容.我预计它将是x空格的字符串.但最后字符串是空的.
问题很简单.
for i in `seq $begin $progress_length` ; do
  progress_bar=$progress_bar'#'
done

for i in `seq $middle $end` ; do
  empty_space=$empty_space' '
done

我需要empty_space来在进度条之后定位内容.我预计它将是x空格的字符串.但最后字符串是空的.我怎样才能创建x空格字符串?

问题可能是因为$empty_space只有空格.然后,要输出它们,你必须用双引号括起来:
echo "${empty_space}some_other_thing"

例如,您可以使用printf尝试更有趣的输出以获得多个空格.例如,要写20个空格:

v=`printf '%20s' ' '`

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读