Change directory and execute file in one command

狂风中的少年 提交于 2019-12-05 12:32:27

问题


When I want to execute a file, it seems that I always have to first 'cd' into that file's directory before executing it, unless it fails on a can't-find-my-dataz type error.

How can I get around typing two commands to just execute a program?

Example:

cd /usr/local/bin/minecraft/
java -Xms512M -Xmx2048M -jar minecraft.jar

How can I make that into one line, so as I can put it as my Exec=_ line when creating a custom launcher in Gnome3?


回答1:


cd /usr/local/bin/minecraft/ && java -Xms512M -Xmx2048M -jar minecraft.jar should do it



来源:https://stackoverflow.com/questions/13624097/change-directory-and-execute-file-in-one-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!