从linux中的某个目录启动shell
在XP中,我可以编写一个包含start
的bat文件,并将其放在我想要单击的任何位置,并使用我放置文件的位置运行cmd,在linux中如何做到这一点?谢谢
in XP I could write a bat file with start
in it and put it wherever I want to click and run cmd with the location I put the file in, how to do that in linux? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此命令为您提供脚本的目录路径,如下所示:
要在脚本中(安全地)使用它,您可以执行以下操作:
This command gives you the directory path of the script, as called:
To use it (safely) in a script, you can for example do this:
cd 进入您希望从代码开头附近操作的目录。
您无法确定从哪里调用代码,因此无法确定代码中的工作目录是什么。解决这个问题的唯一方法是 cd 到脚本中需要的任何位置。
实际上重新阅读您的问题,我不完全确定您想问什么...
您是否正在寻找一种从脚本内调用另一个脚本的方法?
cd into the directory you wish to operate from near the start of your code.
You can't be certain where your code will be called from and thus you can't be certain what the working directory will be in your code. Only way around this is to cd to wherever you need to be within your script.
Actually re-reading your question, I'm not entirely sure what you're trying to ask...
Are you looking for a way to call another script from within a script?
如果您遇到问题,请从桌面/面板/菜单启动脚本:如何启动应用程序?
我正在使用 xUbuntu,并带有德语翻译,因此您必须灵活地为面板采用此解决方案:
我想对于桌面上的启动器图标,方式是类似的。对于菜单条目,请咨询您的管理员。 :) 也许也类似。
If you have trouble, starting the script from the Desktop/Panel/Menu: How do you start your application?
I'm using xUbuntu, and with german translation, so you have to be flexible in adopting this solution for the panel:
I guess for a starter icon on the desktop, the way is similar. For Menu-entries consult your administrator. :) Maybe similar too.