Suppose a user has renamed some files in a current directory using a command like mv filename filename.$$. Write a shell script to search all files and rename them such that they do not contain the shell PID.
a=`echo $$` echo $a ls | grep $a > mvl.lst c=`wc -l mvl.lst | cut -d " " -f 1` while [ $c -gt 0 ] do old=`sed '1q' mvl.lst` new=`sed '1q' mvl.lst | cut -d "." -f 1` mv $old $new sed '/'$old'/d' mvl.lst > mv1.lst mv mv1.lst mvl.lst c=`expr $c - 1` done