I would like to create a code to obtain the following result:
echo -e "\t\tPlease enter your name?"
read name
name="${name,,}"
for i in $(echo "Hello " $name) ; do
echo ${i^}
done | sed 's/^/\t\t/;s/$/, here is your order:/'
If I enter the name like: mike denver
The output is:
<here come out the right space of two tabs>Hello, here is your order:
<here come out the right space of two tabs>Mike, here is your order:
<here come out the right space of two tabs>Denver, here is your order:
Basically, it create the right space from the left side based on the number of tabs that I put (\t
), but it repeats the print line for Hello
plus for each names entered. I didn't understand how to put sed command outside.
My expected result should be this:
<here come out the right space of two tabs>Hello, Mike Denver here is your order:
echo "Hello, ${name^}" | sed ...
? – icarus Mar 19 '20 at 22:47