Enter the command to capture output--help

[ -z $@ ] && echo "PLEASE enter the command to capture output" || echo "Processing your command manual"
x=$#
echo $x
while [ $x -ge 1 ]
                      do
                          while man $@ | read -r line
                                do
                                  >$@.txt
                                  chmod +x $@.txt
                                  exec >>3 $@.txt
                                  echo $line >&3
                                  exec 3<&-
                                done
                           x=$(( x - 1 ))
                      done

 

while executing the code
./man-out-store.sh ps
I found the following error plz help

System command (cd /usr/share/man && (echo ".pl 11i"; /usr/bin/gunzip -c '/usr/share/man/man1/ps.1.gz') | /usr/bin/gtbl | nroff --legacy ISO-8859-1 -man -rLL=77n -rLT=77n 2>/dev/null | /usr/bin/less -iRs) exited with status 36096.
No manual entry for ps
./man-out-store.sh: line 10: /home/tms6/rashmi/ps.txt: Success

I think the clue is in the message:

If you just type into a terminal:

man ps

What do you get?