vendredi 9 janvier 2015

How to pass the content of a file as multiple arguments in bash


I have a file that contains data that gets updated over time (mydata). The file looks like this:



1 2 3


With this file, I want to do this (basically handle each number as a separate parameter):



myscript.sh 1 2 3


Since the data is not static but instead updated over time, I want to run this command:



myscript.sh "$(cat mydata)"


But instead I see ./myscript.sh: line 1: 1: command not found


What should I do?



Aucun commentaire:

Enregistrer un commentaire