简体   繁体   中英

How do I launch an application from a .sh script?

Help me please with a bash script of a few lines.

I have a MyApplication executable in some folder, and I need to make a launcher script to call that application from it's folder when I click it from a grafical interface .

(I need this because I need my application to be launched from it's folder, so that Qt::currentPath() will return the current folder the executable is in)

Please help me, I just had to power off my linux machine two times in a row, I made fork bombs instead of launchers :(.

PS I'm a linux newbie, trying to figure out scripting.

EDIT

More about my current problem: Qt how to open a file in current dir ? or what's wrong with this?

Details: MyApplication is a GUI project compiled in Qt-Creator. It uses .xml files for storage. If I cd manually to the folder the executable is in, and run it, everything works fine, the application knows the path to the .xml files (current directory). But, if I just click the icon of the application it launches from $HOME, and my application is not able to find those .xml files.

That's why, I suppose, I need a .sh launcher, to call it from it's directory when I'll click it.

If its a graphical application, any sort of link will do. That works fine for me, unless you have something I'm not aware of, in which case please explain more.

Ps, fork bombs are limitable - http://forums.debian.net/viewtopic.php?f=10&t=44480&start=0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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