Shell for loop exercises-equilateral triangle

Source: Internet
Author: User
[email protected] ~]# cat sanjiaoxing.sh #!/bin/bash
# Crushlinux
# 2017-04-10 Read-p "Please enter the length of the equilateral triangle one side:" Longfor ((a=1;a<=long;a++)) do echo-n " " for ((b= $long; b>a;b--)) #控制空格输出 Do echo -n "" Donefor C in ' seq 1 $a ' #输出所在行数相同的数字个数do echo-n "$a" donefor D in ' seq 2 $a ' #输出所在行数减一的数字个数do echo- N "$a" Doneecho "" done[[email protected] ~]# bash sanjiaoxing.sh Please enter the length of the equilateral triangle one side: 8 1 222 33333 4444444 555555555 66666666666 7777777777777 888888888888888

  

Shell for loop exercises-equilateral triangle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.