Tuesday, January 2, 2024

How to store command output in bash variable

x="$(head -15 testfile.txt)"

This would store the first 15 lines of testfile.txt in variable x.

No comments:

Post a Comment

Popular Posts