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

rest - Spring boot: Request method 'PUT' not supported -

php - Magento - Deleted Base url key -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -