简体   繁体   English

终端查找特定文件

[英]Terminal Find Specific File

NOTE: This is for MacOSX 注意:这适用于MacOSX

I am working on a launcher for an app and the only way I can make terminal find the file is putting the direct root. 我正在为应用程序启动程序,而我可以使终端找到文件的唯一方法是放置直接根目录。 If I can get around this so it would work in any location what would the code be? 如果我能解决这个问题,那么它将在任何位置工作,代码将是什么? Here is the code in the executable: 这是可执行文件中的代码:

#!/bin/bash  
python /Users/imac/Desktop/Notepad+/Contents/main.py  

The path always will change from computer to computer. 路径总是会因计算机而异。 You can run executable in the same directory with 您可以使用以下命令在同一目录中运行可执行文件:

python main.py

for python 3 对于python 3

python3 main.py

Your shell script will be like. 您的shell脚本将像。

#!/bin/bash  
python main.py  

I hope it will help 希望对您有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM