Consider you have a file with some sort of terminal command. How might each line be executed? Can you pipe the output of more into an eval
?
%> more ./foo.txt
Edit:
After some help/guidance from the comments, I think I should also make note that it's been a while since I've done any shell scripting, so while I say eval
I may mean echo
or some other way of executing code.
If foo.txt contains various lines of code, but I want to execute the line that contains echo 'bar bar'
, I'm looking for a way to do that from, let's say a grep
. Something logically similar to:
grep echo foo.txt | xargs echo