How to pass multiple inputs in command-line?


Question [How to pass multiple inputs in command-line?] has 1 solution 2020-08-19 06:05:34 linux

I am trying to execute a command that merges chromosome data. As I need to merge data from chromosomes 1..22 and X and Y, I wanted to see if there is a better way to do this. I can provide myfile.list below to merge chromosome data.

plink1.9 --bfile --merge-list myfile.list --make-bed --out mymerged

myfile.list is a text file that would contain:

data.chr1.b
data.chr2.b
...
... 
data.chr22.b
data.chrX.b
data.chrY.b

Instead of supplying a text file myfile.list, I wanted to use a variable with all data names in this command. What would be the better way to do this? Something like this?

plink1.9 --bfile --merge-list cat `echo "data.chr"{1..22}. X. Y.` --make-bed --out mymerged 

Question [How to pass multiple inputs in command-line?] solution number 1

Use process substitution

plink1.9 --bfile --merge-list <(for i in {1..22} X Y; do echo data.chr$i; done) --make-bed --out mymerged 

.htaccess .net .net-core 2d 3d 3d-printing abstract-syntax-tree actions-on-google actionscript-3 activemq acumatica adobe-xd aframe ag-grid air airflow ajax akka alexa algorithm alignment allure amadeus amazon-cognito amazon-deequ amazon-dynamodb amazon-ec2 amazon-redshift amazon-s3 amazon-sqs