1

script to extract PID

view story
linux-howto

http://www.unix.com – Can anyone explain the below script which is used to extract the PID? Why they are taking from 10 character and getting the sub string? Note:variable pid has been assigned the PID value initially as below. pid=`sed 's@FILNAME@'$destFil'@g' $scriptname |sed 's@SRCFILE@'$sourceFil'@g' |sed 's@CDNODE@'$CdNod'@g' |sed 's@TEMPL@'$FIL_LOCAT'@g'|sed 's@INDIC@'$acc_id'@g' | $CDCMND -r | grep "_CDPNUM_"` len1=`expr length "$pid"` len2=`expr $len1 - 9` pid=`expr substr "$pid" 10 $len2` (HowTos)