Working on zsh on MacOS...
I was wondering if there was a way to query files via an index # of the current directory. For example, if ls
outputs:
folder1
folder2
file1.txt
file2.txt
I was wondering if there was a way to run a command such as open $FILES[2]
to open file1.txt
(assuming 0 index).
I noticed that the command open *
opened all individual folders and files of the current directory (finder/default apps), but commands like open *[0]
weren't recognized.
My end goal is to find an easy way to both open and pass files, whose names are particularly long to other programs. A screenshot for example typically has a long file name and if I wanted to pass to ImageMagik or something, I figured this sort of file reference would be most efficient.
I should mention I'd be willing to switch from zsh to bash if this were an option there.