I am trying to create a script that will be getting one variable from user and should print a pyramid as below:***************I used this script but it shows me numbers:for i in {1..5}doa=${a}${i}echo ${a}donethe output:112123123412345How can I insert * sign instead of numbers?
How to create loop sequence?
linux;shell script
Simply append the * character to the a variable, instead of the loop counter:for i in {1..5}do  a+='*'  echo ${a}doneNote that a=${a}* instead of a+='*' works just as well, but I think the += version is neater/clearer.If you want to do this with a while loop instead, you could do something like this:while (( ${#a} < 5 )); do  a+='*'  echo $adone${#a} expands to the length of the string in the a variable.Note that both of the above code snippets (as well as the code in the question) assume that the a var is empty or not set at the start of the snippet.  If this is not the case, then you'll need to reinitialize it first:a=I am assuming you are using the bash shell.  Here is the full manual.  Here is the section on looping constructs.