bash: how to execute a line from a file? -


i guess easy couldn't figure out. have command history file , i'd grep line , execute it. how do it?

for example: in file command.txt file, there is:

wc -l *txt| awk '{ofs="\t";print $2,$1}' > test.log

suppose above line last line, want this

tail -1 command.txt | "execute" 

i tried use

tail -1 command.txt | echo  

but no luck.

can tell me how make work?

thanks!

just use command substitution

bash -c "$(tail -1 command.txt)" 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -