Sample Header Ad - 728x90

How to redirect output from a program that waits for input

0 votes
2 answers
109 views
Following this post I created my own version of the script, with the difference that user and password are forwarded from the environment variables:
#!/bin/zsh


pamtester login $user authenticate << eof 
echo $pwd
eof
How is it possible to redirect the output of the pamtester to a variable within the script? It looks like I always have the pamtester output to the terminal Password: pamtester: successfully authenticated or Password: pamtester: Authentication failure and everything that I insert after the eof line is ignored.
Asked by Namal (101 rep)
Apr 11, 2025, 11:07 AM
Last activity: Apr 22, 2025, 04:35 PM