Reputation: 3153
I have a bash code that read input from a file.
for line in $(cat python.py); do
read input
echo $input;
echo "[$line]"
done
What i want is to read input in a complete clear terminal screen including the prompt like it does in VIM.
Upvotes: 0
Views: 352
Reputation: 785008
You can do:
while read line; do
read input
echo $input;
echo "[$line]"
clear
done < python.py
See clear
at the end of the loop to clear the terminal.
Also no need of redundant cat
since file can be read from stdin redirection.
Upvotes: 0
Reputation: 352
Maybe you can clear the prompt by changing the environment variable PS1. Something like
OLDPS1=$PS1
PS1=
clear
should clear your screen and let you input whatever you want with no prompt at all. Restore the variable PS1 once finished with
PS1=$OLDPS1
Upvotes: 4