bash - Execute another script inside heredoc Doc That expect user input in shell -
i have script based upon user input need call script run pbrun admin made menu ps3
, select
, based upon input call function inside i'm running pbrun , pass here doc input this.
function calls { pbrun -l /bin/su - admin <<'inner_eof' /home/ankur/testwithout.ksh inner_eof }
now every thing runs fine if call script uses ps3
, select
give menu , needs user input command line proceed i'm not able provide calling script input provided input taken script not 1 call admin
any idea how can achieve this.?
ps: cannot use expect
cannot install it. not have access install on systems.
admin script written using ksh
shell
seems me want pipe output:
/home/ankur/testwithout.ksh | pbrun -l /bin/su - admin
or use process substitution:
pbrun -l /bin/su - admin < <(/home/ankur/testwithout.ksh)
command <(...)
process substitution, creates temporary "file" in /proc/self/fd/
...
write to, , temporary file's name returned argument command
:
% echo <(ls) /proc/self/fd/11
here docs text, , << 'xyz'
input interpreted single quoted string, command substitution wouldn't work, , neither parameter expansion.
command < file
redirect file
input command
.
Comments
Post a Comment