Change directory and execute file in one command

2020-06-08 03:49发布

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条回答
手持菜刀,她持情操
2楼-- · 2020-06-08 04:09

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

查看更多
登录 后发表回答