troubleshooting Question

How to use IFS to get output of range in comma separator in bash?

Avatar of beer9
beer9Flag for India asked on
Linux* BashScripting Languages
2 Comments1 Solution251 ViewsLast Modified:
I would like to have output like below

ns2.com,ns3.com,ns4.com,ns5.com,ns6.com,ns7.com,ns8.com,ns9.com,ns10.com,

which I am able to get from below command in bash

$printf '%s,' ns{2..10}.com
ns2.com,ns3.com,ns4.com,ns5.com,ns6.com,ns7.com,ns8.com,ns9.com,ns10.com,

I am wondering if I can get something like this using IFS (Internal Field Separator) in bash

something like
IFS=, ns{2..10}.com

which obviously doesn't work. Appreciate any suggestion :-)
ASKER CERTIFIED SOLUTION
nociSoftware Engineer
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros