sh Bash - 创建桌面项目。此文件将放在bin目录的正上方。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Bash - 创建桌面项目。此文件将放在bin目录的正上方。相关的知识,希望对你有一定的参考价值。

1. Don't forget to save the icon to the bin directory.
2. The launching file may be changed to as follows:

```bash
#!/bin/sh
DIR=`dirname $0`
cd $DIR
./java -m Passwords/passwords.Main -Dfile.encoding=UTF-8 $@
```

This will ensure that the working directory of the app will be the bin directory.
#!/bin/bash
#
# Hello!!!
#
# To run this file, click with the right button of the mouse 
# and check Properties > Permissions > Allow Executing this app
# then click on it again and execute it.
#
# After that, go to the Desktop. There you will see a new desktop item.
# Click on this desktop item and allow it run
# to launch the application
#
 
DIR="$(dirname $0)"
FILE="$HOME/Desktop/mypasses.desktop"
if [ -e $FILE ]; then
  echo "Desktop item $FILE already exists!"
  read -n 1 -s -r -p "Press any key to finish... "
else 
  echo "#!/usr/bin/env xdg-open" >> $FILE
  echo "[Desktop Entry]" >> $FILE
  echo "Type=Application" >> $FILE
  echo "Terminal=true" >> $FILE
  echo "Exec=bash $DIR/bin/password" >> $FILE
  echo "Name=My New Passwords" >> $FILE
  echo "Icon=$DIR/bin/password.png" >> $FILE
  chmod u+x $FILE
fi

以上是关于sh Bash - 创建桌面项目。此文件将放在bin目录的正上方。的主要内容,如果未能解决你的问题,请参考以下文章

linux使用.sh文件启动.jar文件?

sh 此bash脚本为在Raspberry Pi 3上运行的Google智能助理创建系统单元文件和启动文件。还启用并启动

Linux Gvim 创建第一个shell脚本

如何包含具有相对路径的 bash 脚本? [复制]

Linux bash输出带日期时间的日志文件

Linux bash输出带日期时间的日志文件