1. 程式人生 > >ubuntu下編寫shell指令碼並在桌面上設定快捷方式

ubuntu下編寫shell指令碼並在桌面上設定快捷方式

1、sudo gedit realsense.sh
#! /bin/bash
realsense-viewer

2、pwd
/home/suns/Workspace/zz/   '''輸出sh檔案所在的資料夾'''

3、go to  /usr/share/applications:
sudo gedit realsense.desktop

4、add:
[Desktop Entry]
Encoding=UTF-8
Name=realsense
Type=Application
Icon=cheese        '''圖示可自選,換對應的路徑即可'''
Categories=Application;
StartupNotify=true
Terminal=false
Exec=sh /home/suns/Workspace/zz/realsense.sh  '''sh 後跟 要執行sh檔案的絕對路徑即可'''

5、sudo chmod a+x realsense.desktop  '''給該檔案賦予許可權'''

6、把生成的圖示拖到桌面上即可直接點選開啟