Hello I want my script to output the following:
string1 string2
string1 string2 string2
string1 string2 string2 string2
string1 string2 string2 string2 string2
Etc. for about 20 times or so.
I've tried the following:
#! /bin/bash
string1=hello
string2=world
#for {i=1;i=<10;i=i+1};
#echo $string1 + $string2
#!/bin/bash
for ((number=1;number < 10;number++))
do
echo $string1 $string3
string2 *10
done;
exit 0
Now I can't find anything on the web about just looping and adding strings.. Thanks for any help! Greets
s1="hello";s2="world"; for i in {1..10}; do s1="$s1 $s2"; echo $s1; doneforloop as seen in the question, or use awhileloop for POSIX compatibility.for i in $(seq 10)?{...}is OK for generating non-sequential ranges like{foo,bar,baz}.{txt,png,gif}. Just don't use it for "predictable" sequences you can generate from a formula in constant space.)