'Browse and execute a command on the selected line

I have a list of topics in topics.list

$ cat topics.list
maths
science
geography
...

I want to browse these topics (like in the less command), and at the same time I want to execute my own command (echo $line > selected_topic.txt) on a line that I choose



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source