Sunday, May 5, 2024
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 910  / 3 Years ago, thu, november 11, 2021, 3:50:13

Sometimes I want to run certain files, but I don't want to navigate all the way to the folder.



If I know the file name and find -name file_name.py only returns one result, can I just use that?



For example, instead of navigating all the way to a specific folder and calling:



python file_name.py


Can I write:



python [ find -name file_name.py ] 


or



python [ locate file_name.py ]


Or some sort of variant for 'search my entire computer for this file name and use it'? Preferably in one line.


More From » command-line

 Answers
5

I think you're looking for:



python $(find -name myscript.py)

[#25809] Friday, November 12, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rstride

Total Points: 305
Total Questions: 112
Total Answers: 118

Location: Mali
Member since Sat, Dec 26, 2020
3 Years ago
;