LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 05-03-2018, 06:56 AM   #1
pantiri
LQ Newbie
 
Registered: May 2018
Posts: 4

Rep: Reputation: Disabled
Unhappy how to use command coproc inside a script


Command coproc in linux, allows peoples to create a new process in background and allows ones to send commands to it

It works very well from command line, but when I try to launch it in a shell script, nothing happens

Exp: I'm trying to anable scanning Bluetooth feature a a raspberry py

Form command line these commands work well
coproc sudo bluetoothctl
echo -e 'scan on' >&${COPROC[1]}

But ig I try to use them in a script like this

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

the script does nothing
If someone can help
 
Old 05-03-2018, 08:28 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
You've asked a follow-up question about this exact topic in the Programming forum on an old thread, https://www.linuxquestions.org/quest...ng-4175615328/

Please continue to use that question.

You can also refer to the bash links in my signature for some tips about how to debug bash scripts.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ls command inside bash script error sopier Programming 11 12-17-2011 10:19 PM
[SOLVED] echo command inside expect script Soji Antony Linux - Newbie 2 11-23-2011 06:50 AM
invoking windows command inside a shell script nano2 Programming 6 09-09-2009 03:46 AM
linux command inside perl script von_vea Programming 5 09-08-2009 01:54 PM
Run command as root inside script an_sush Linux - Newbie 19 09-04-2009 08:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration