Execute two commands sequentially in autostart desktop file

All questions and problems regarding LXDE components including LXSession, LXAppearance, GPicView, Leafpad, LXTerminal, Xarchiver, LXNM to be discussed here.

For PCManFM questions, please ask in the dedicated forum below.
Locked
modest
Posts: 3
Joined: Tue Aug 18, 2009 8:24 am

Execute two commands sequentially in autostart desktop file

Post by modest »

I am using LXDE on my Debian 5.0 system. I am trying to auto-execute the following two commands sequentially:

Code: Select all

less /root/README.TXT  #(Basically a README file)
and then

Code: Select all

./root/install.sh #(a shell script)
So I created a auto.desktop file in ~/config/autostart directory whose contents are:

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=AutoStart
Comment=README and Script
#Exec=xterm -e less '/root/README.TXT' && xterm -e '/root/install.sh'
Exec=lxterminal --command "less /root/README.TXT" && lxterminal --command "/root/install.sh"
Terminal=true
Now I have tried both the "Exec" command above and none of them worked for me. For the first one Exec (the one commented) only the first command (README) gets executed. For the second command, only the later (install.sh) command gets executed.

How do I make two files launched sequentially (the second one - install.sh) executed only after user closes the first one - README.TXT).
maces
Posts: 503
Joined: Sat Oct 25, 2008 6:04 pm
Contact:

Re: Execute two commands sequentially in autostart desktop file

Post by maces »

Hi

I would write a third script which launches the first one and then the second one:

Code: Select all

#!/bin/bash
# run_install.sh
less /root/README.TXT
/root/install.sh
exit 0
The desktop file :

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=AutoStart
Comment=README and Script
Exec=lxterminal --command "run_install.sh"
Terminal=true
modest
Posts: 3
Joined: Tue Aug 18, 2009 8:24 am

Re: Execute two commands sequentially in autostart desktop file

Post by modest »

Hi Maces,

I already did that just in case if there is no way to do this with just one command line.

I guess I will have to go with that route since it looks like it is not possible.

I was just trying to avoid managing one more file (even thought it is a simple file).

Thank you for the reply, though.
PCMan
Posts: 85
Joined: Mon Oct 06, 2008 9:52 am

Re: Execute two commands sequentially in autostart desktop file

Post by PCMan »

modest wrote:Hi Maces,
I already did that just in case if there is no way to do this with just one command line.
I guess I will have to go with that route since it looks like it is not possible.
I was just trying to avoid managing one more file (even thought it is a simple file).
Thank you for the reply, though.
Try this:

Code: Select all

Exec=sh 'cmd1 && cmd2'
Maybe this works?
Locked