作者: xiao 時間: 2016-4-10 23:26 標題: SHELL SCRIPT 可以不要每次问如何执行吗, 解决了
本帖最後由 xiao 於 2016-4-15 14:10 編輯
[attach]1880532[/attach]
[attach]1880545[/attach]
后来楼下的高手给了 ./desktop 的方法,终于达成了,一般使用者就方便了很多,特别是WINDOWS的。详情看楼下的方法。
另外实验过用 asm 写个简单的 system call scrot -b -s, 不同 SHELL SCRIPT 的方法, 也可以执行,但还是继续问,只是选项少了。
不过有了这个 ./Desktop 的方法后,system call 也可以照猫画虎,有兴趣的自己编译一下,再改改 a.desktop就好用得很了
[code]
@ REF : http://www.science.smith.edu/dft ... th_the_Raspberry_Pi
@ xiaolaba
@ 2016-04-14
@ modified to test 'system' call and to invoke scrot to capture a screen
@ how to assenble and link, open terminal, type following, but remove @
@ as -o hello.o hello.s
@ gcc -o snap hello.o
@ hello.s
@ D. Thiebaut
@ Just your regular Hello World program!
@
@ ---------------------------------------
@ Data Section
@ ---------------------------------------
.data
string: .asciz "\nHello World! This is xialaba and Linux programming\n\n"
para : .asciz "scrot -b -s"
@ ---------------------------------------
@ Code Section
@ ---------------------------------------
.text
.global main
.extern printf
.extern system
main:
push {ip, lr}
ldr r0, =string @ print hello world
bl printf
ldr r0, =para @ invoke scrot to capture screen
bl system
pop {ip, pc}
[/code]
作者: stta800 時間: 2016-4-10 23:44
save as xxx.sh??
作者: kuro_sora 時間: 2016-4-11 00:00
提示: 作者被禁止或刪除 內容自動屏蔽
作者: FlyingForever 時間: 2016-4-11 10:58
不熟你用的desktop environment
如果可以設定用甚麼程式打開檔案的話(像設定用gedit打開.txt檔),你可以設定用/bin/bash打開.sh檔
不過這樣其實有點危險,我覺得還是用terminal打開比較好,常用的腳本可以設定alias
via HKEPC Reader for Android
作者: xiao 時間: 2016-4-15 01:04
回覆 4# FlyingForever
以前 ubuntu 实验过可以,不过 raspbian 好像不行
作者: quintus 時間: 2016-4-15 10:58
你可以 create 個 .desktop file
http://www.raspberry-projects.co ... i/desktop-shortcuts
詳情可以睇
https://specifications.freedesktop.org/desktop-entry-spec/latest/
作者: xiao 時間: 2016-4-15 13:50
回覆 6# quintus
谢谢你
这样就解决了
实验了
桌面建立一个文字档 a.desktop,内容如下,
存档后他会自动变成可执行的式样,同时显示名称也不再是a.desktop
点两下就执行了那个 SHELL SCRIPT, 不再提示了
[code]
[Desktop Entry]
Name=snag_windows
Comment=call scrot -b -s to capture a window screen
Icon=/usr/share/pixmaps/openbox.xpm
Exec=lxterminal -t "Screen capture" --working-directory=/home/pi/Desktop/ -e ./capture_screen.sh
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;
[/code]
[attach]1881544[/attach]
