I would like to create a command that takes 3 args (directory to search in, pattern to match, and then file to create where data is written) but am a bit stuck because I can't figure out how to get inodes to show for these search results as well to be written in the file. It would be something like:
for i in "directory" if name = "pattern", inodes > "file"
like it should be simple and yet I cannot seem to get it? Here is what I have so far, but it doesn't show inodes (ls -i tends to show all subdirectories regardless of pattern match) and says my 3rd argument is too ambiguous...
#!/bin/bash
find "$1" -name "*$2*" > "$3"
I am wondering if I should be using something like ls /$directory -i but I feel like the syntax would not work.