I am checking files at remote sever in /temp directory and storing the count of the files in a temp files and doing scp to local sever. When I am running below command on console, its running file but its not working in shell script.
ssh id@$remote_sever
cd /temp
ls *.txt | wc -l > /temp/temp.txt
scp /temp/temp.txt infa_id@local_sever:/TEMP
exit