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:

     sudo ./recv_csi tst.dat

Script run_sd.sh with the content:

     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:


     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.

  • 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. – steeldriver Feb 10 '17 at 17:48
  • Try cd $pathToRecvCSI && ./run_rd.sh – Louis Papaloizou Feb 15 '17 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.