linux - How to properly format this command: Exec=a=$(service httpd restart 2>&1) && notify-send "$a" -


i trying figure way fix code exec= line can work properly.

[desktop entry] name=a genericname=a exec=a=$(service httpd restart 2>&1) && notify-send "$a" terminal=false type=application startupnotify=true mimetype=text/plain; icon=/root/desktop/111.svg 

this panel shortcut created copying app's shortcut.

i tested , worked great with..

exec=notify-send 'a' 

in other words execute command.

but trying stuff 2 commands in line .. seen above.

you need start wrapper shell, this:

exec=bash -c "notifiy-send \"$(command)\"" 

note: don't miss double quotes around $(command)

what makes in case:

exec=bash -c "notifiy-send \"$(service http restart)\"" 

or if user need authenticate use gksu:

exec=bash -c "notifiy-send \"$(gksu service http restart)\"" 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -