CyberKeeda In Social Media

How to echo output everytime from a new line

Might be it would be a silly post for some, but it could be helpful for those who got this link from google.

So here are few words =, take it as a example.

What i have with me that looks like --    cat  rat mat fat 

Requirement is that i want to use it as 


So A simple trick is just to use /n in the below mentioned manner.

# echo -e "cat\nrat\nmat\nfat" 

Now if you are playing with variables then you just need to add $ , here my variables are simply dep1,dep2,dep3,dep4

# echo -e "$dep1\n$dep2\n$dep3\n$dep4" 

his is really helpful in shell scripts as texts in this manner can be further used in various loops.

No comments:

Post a Comment

Designed By Jackuna