Send string to another process stdin [duplicate]












0















This question already has an answer here:




  • How to redirect STDIN of background process?

    2 answers



  • Shell Script: Sending input to background process

    2 answers




Example process waiting an input sent to background



$ read -p "Input text and hit ENTER to exit" &


I try to write to stdin (fd/0) with n



$ echo -e "okn" > /proc/$!/fd/0


but



$ fg

read -p "Please hit ENTER"


so the process is still running, then string "okn" never reach it



How can I send a string+ENTER to another process STDIN?










share|improve this question













marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 20 '18 at 20:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • What to you want to achieve with that? Maybe another way would also be OK (like setting a default value before, and use timeout parameter -t for read)?
    – Jaleks
    Dec 20 '18 at 20:18










  • to achieve = send ENTER from stdout one to another process stdin
    – Hernán Eche
    Dec 20 '18 at 20:27
















0















This question already has an answer here:




  • How to redirect STDIN of background process?

    2 answers



  • Shell Script: Sending input to background process

    2 answers




Example process waiting an input sent to background



$ read -p "Input text and hit ENTER to exit" &


I try to write to stdin (fd/0) with n



$ echo -e "okn" > /proc/$!/fd/0


but



$ fg

read -p "Please hit ENTER"


so the process is still running, then string "okn" never reach it



How can I send a string+ENTER to another process STDIN?










share|improve this question













marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 20 '18 at 20:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • What to you want to achieve with that? Maybe another way would also be OK (like setting a default value before, and use timeout parameter -t for read)?
    – Jaleks
    Dec 20 '18 at 20:18










  • to achieve = send ENTER from stdout one to another process stdin
    – Hernán Eche
    Dec 20 '18 at 20:27














0












0








0








This question already has an answer here:




  • How to redirect STDIN of background process?

    2 answers



  • Shell Script: Sending input to background process

    2 answers




Example process waiting an input sent to background



$ read -p "Input text and hit ENTER to exit" &


I try to write to stdin (fd/0) with n



$ echo -e "okn" > /proc/$!/fd/0


but



$ fg

read -p "Please hit ENTER"


so the process is still running, then string "okn" never reach it



How can I send a string+ENTER to another process STDIN?










share|improve this question














This question already has an answer here:




  • How to redirect STDIN of background process?

    2 answers



  • Shell Script: Sending input to background process

    2 answers




Example process waiting an input sent to background



$ read -p "Input text and hit ENTER to exit" &


I try to write to stdin (fd/0) with n



$ echo -e "okn" > /proc/$!/fd/0


but



$ fg

read -p "Please hit ENTER"


so the process is still running, then string "okn" never reach it



How can I send a string+ENTER to another process STDIN?





This question already has an answer here:




  • How to redirect STDIN of background process?

    2 answers



  • Shell Script: Sending input to background process

    2 answers








linux bash process proc stdin






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 20 '18 at 20:07









Hernán Eche

666




666




marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 20 '18 at 20:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 20 '18 at 20:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • What to you want to achieve with that? Maybe another way would also be OK (like setting a default value before, and use timeout parameter -t for read)?
    – Jaleks
    Dec 20 '18 at 20:18










  • to achieve = send ENTER from stdout one to another process stdin
    – Hernán Eche
    Dec 20 '18 at 20:27


















  • What to you want to achieve with that? Maybe another way would also be OK (like setting a default value before, and use timeout parameter -t for read)?
    – Jaleks
    Dec 20 '18 at 20:18










  • to achieve = send ENTER from stdout one to another process stdin
    – Hernán Eche
    Dec 20 '18 at 20:27
















What to you want to achieve with that? Maybe another way would also be OK (like setting a default value before, and use timeout parameter -t for read)?
– Jaleks
Dec 20 '18 at 20:18




What to you want to achieve with that? Maybe another way would also be OK (like setting a default value before, and use timeout parameter -t for read)?
– Jaleks
Dec 20 '18 at 20:18












to achieve = send ENTER from stdout one to another process stdin
– Hernán Eche
Dec 20 '18 at 20:27




to achieve = send ENTER from stdout one to another process stdin
– Hernán Eche
Dec 20 '18 at 20:27










0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Morgemoulin

Scott Moir

Souastre