1

I have a script file script1.sh as shown below:

#!/usr/bin/env bash 

cd /home/userA/scripts

. r1.sh

when I manually open a terminal and run it using . script.sh it works fine.

But when I created the below .desktop launcher to run it says that ROSRUN command not found.

This is the .desktop file:

[Desktop Entry] 
Version=1.0 
Type=Application 
Terminal=true 
Icon[en_AU]=/home/userA/Pics/pic1.png 
Name[en_AU]=automatic 
Exec=/home/userA/Desktop/script1.sh 
Comment[en_AU]=comment 
Name=automatic 
Comment=comment 
Icon=/home/userA/Pics/pic1.png

And this is how r1.sh looks like:

#!/bin/bash 
rosrun r1 r1 \ 
-p1 $p1 \ 
-p2 $p2 \ 
-p3 $p3

So if anyone could please advise what may be the reason behind this happening. As I don't know why it runs smoothy without this error appearing when manually opening a terminal and running it, and why the error appears when I use .desktop launcher instead?

7
  • I assume r1.sh is located in the same directory as script1.sh is. If so, Use the full path in script1.sh, else it won't be found.
    – s3lph
    Sep 23, 2014 at 17:54
  • @the_Seppi sorry, I forgot to put the cd command . So no, they are not on the same path.
    – Tak
    Sep 23, 2014 at 18:05
  • What happens if you execute script1.sh instead of sourcing it?
    – s3lph
    Sep 23, 2014 at 18:08
  • as shown in the.desktop file I'm using Exec=/home/userA/Desktop/script1.sh what do you want me to do?
    – Tak
    Sep 23, 2014 at 18:13
  • Run exactly the command after the Exec=. And your desktop file seems to lack a [ in the first line, if this isn't a C&P mistake.
    – s3lph
    Sep 23, 2014 at 18:14

1 Answer 1

2

As I found out in a chat with the asker, rosrun is a command he defined in his .bashrc.

Add the same definition for rosrun to your script1.sh and it should work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .