Reputation: 2877
AIM: I would like to tail the last line of the file.txt and input into a variable to use for substitution via sed.
CODE:
ALARM_POPUP_CONTENT=(tail -1 /logs/file.txt)
ALARM_POPUP_CONTENT=tail -1 /logs/file.txt
OUTCOME:
This is only outputtin the work 'tail' or an error command not found for the seond option. Any suggestions?
Upvotes: 2
Views: 11333
Reputation: 30210
Try:
ALARM_POPUP_CONTENT=$(tail -1 /logs/file.txt)
or with backticks:
ALARM_POPUP_CONTENT=`tail -1 /logs/file.txt`
Upvotes: 3