On Fri, 12 Mar 2021, SAIFI wrote:
On Fri, 12 Mar 2021, Aahna S. wrote:
but i want to find it as
find /home/aahna -iname "*.md" to find all the files
now if there is a match then the command should automatically open the .md
file.
understood your issue better.
the problem has two parts
1. find all the text files matching a particular criteria
2. pipe the output to vi(m)
now the issue is that, matching file name when piped to vi(m) will lead to a
garbled terminal and most likely a hung editor.
need to explore this a bit.
the path to constructing a solution requires us to acomplish two tasks.
1. use 'vim' as a child process
2. reopen stdin as /dev/tty in the child process before executing the command
hence
find /home/aahna -iname "*.md" | (IMPL_CHILD_PROC_AND_REOPEN_STDIN) vim
solution
create command line using 'xargs'
reopen stdin as '/dev/tty' in child process using '-o'
find /home/aahna -iname "*.md" | xargs -o vim
::Saifi