dc and standard input or heredoc with string command?
4
votes
1
answer
443
views
dc
can read command from a file or/and from standard input.
If I want to print user input :
cat essai_dc
[enter a number : ]
n
?
p
dc essai_dc
enter a number : 4
4
Now, if I try with a heredoc
:
dc [enter a number : ]
> n
> ?
> p
> EOF
enter a number : dc: stack empty
I get the same with standard input :
cat essai_dc | dc
enter a number : dc: stack empty
The command ? get the p
and execute it but the stack is empty.
Is it possible to get it to work (tell dc
to wait for the input)
Asked by ctac_
(1968 rep)
Apr 6, 2021, 01:45 PM
Last activity: Apr 6, 2021, 03:59 PM
Last activity: Apr 6, 2021, 03:59 PM