1

I'm trying to do a simple shell script that will make my raspberry's bluetooth discoverable but i'm facing some issues. My raspberry is running Raspbian.

Running this through command line works perfectly:

coproc bluetoothctl
echo -e 'discoverable on' >&${COPROC[1]}

But when i create a shell script doing the following:

#! /bin/bash
coproc bluetoothctl
echo -e 'discoverable on' >&${COPROC[1]}

with the command line "sh test_script.sh", i got the following error:

"test_script.sh: 3: test_script.sh: coproc: not found"

Can someone give me a hand? Thanks!

1 Answer 1

1

Invoke it either with ./test.sh or bash test.sh. By using sh test.sh you're falling back to shell only, not Bourne Again SHell, bash.

2
  • Hello! Thanks for your answer, it indeed fixed my problem! Now when i'm executing the script the bluetooth is not discoverable... Do you have any idea why? It looks like the coproc doesn't execute my command even though it's working outside of the script.
    – Kamigaku
    Aug 22, 2019 at 11:58
  • @Kamigaku Try asking on the Linux/UNIX SE. This question was about coproc.
    – user2497
    Aug 22, 2019 at 12:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.