0

I want to run two c programs in the home directory, but the programs are stored in another directories, where each has own directory. So, I do followings:

I have two scripts for each program in their directories:

Script run_rd.sh with the content:

     #!/bin/bash
     sudo ./recv_csi tst.dat

Script run_sd.sh with the content:

     #!/bin/bash
     sudo ./send_Data wlan4 00:01:02:03:04:05 10

I have another script in the home directory, which calls the scripts from above. The goal is to run both c programs at the same time:

Script run.sh with the content:

     #!/bin/bash
     pathToRecvCSI="/home/ubuntu/A-Tool-APP/recvCSI/"
     pathToSendData="/home/ubuntu/A-Tool-APP/sendData/"


     sh $pathToRecvCSI"run_rd.sh" &  PIDIOS=$!
     sh $pathToSendData"run_sd.sh" &  PIDMIX=$!
     wait $PIDIOS
     wait $PIDMIX

After execution I get the following output:

  sudo: ./send_Data: command not found
  sudo: ./recv_csi: command not found

But, if I will execute run_sd.sh/run_rd.sh separately in their directories, they run as normal.

What is the reason why the run.sh prints that output? Could someone help me?

PS: All scripts has executable permissions.

2
  • 3
    Because ./ means the current directory - you either need to change to the respective directory first, or use an absolute path. Also, don't use sh (dash) to run bash scripts. Feb 10, 2017 at 17:48
  • Try cd $pathToRecvCSI && ./run_rd.sh Feb 15, 2017 at 20:57

0

You must log in to answer this question.

Browse other questions tagged .