Skip to content

Instantly share code, notes, and snippets.

@deomorxsy
Last active June 16, 2019 23:59
Show Gist options
  • Save deomorxsy/e4fb80a8a3347b4583c027abc5e78352 to your computer and use it in GitHub Desktop.
Save deomorxsy/e4fb80a8a3347b4583c027abc5e78352 to your computer and use it in GitHub Desktop.
opening a file from CLI with bash syntax (WIP)

Opening files with bash results

gimp $(ls | grep '027')
  • here we use the ls command, with the grep filter '027' to search for our image. We associate this result with a variable that is represented by "$". Then we call it with gimp, so we can open faster.

  • in fact, this can be used with any program you want. You just have to be sure that the program will open the extension from the file. To do this, just replace "gimp" with the right command.

complementary reading:

"How can I open a file that results from grep?" - https://unix.stackexchange.com/questions/115591/how-can-i-open-a-file-that-results-from-grep?newreg=06aef156cfab419eb861c0016b470649

"How to start line with command from output of another command" - https://unix.stackexchange.com/questions/110146/how-to-start-line-with-command-from-output-of-another-command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment