loop question

HI ALL

How to read first 10 line from a file using any method

head -n 10 <filename>

thx
I have one question more

cp="/tmp/log.222.$$"

what does this means

and i am doing this and giving me error

path=$(mktemp /tmp/path.XXXXXX) || exit1
dt=`date +%Y%M%D`

cp="/tmp/log.222$dt"
cp -rfv  $path $cp


/tmp/path.UC5iNo' -> `/tmp/log.777.082411/22/08'
cp: cannot create regular file `/tmp/log.777.082411/22/08

$$ = The PID number of the process executing the shell.

use

dt=`date '+%Y%m%d'`

You was using:
%Y = Year
%M = Minutes (00-59)
%D = Date in %m/%d/%y format

%a Abbreviated weekday.
%b Abbreviated month name.
%c Country-specific date and time format.
%d Day of month (01-31).
%h Same as %b.
%j Julian day of year (001-366).
%k Hour in 24-hour format, without leading zeros (0-23).
%l Hour in 12-hour format, without leading zeros (1-12).
%m Month of year (01-12).
%n Insert a new line.
%p String to indicate a.m. or p.m.
%r Time in %I:%M:%S %p (12-hour) format.
%s Seconds since "the Epoch," which is 1970-01-01 00:00:00 UTC (a nonstandard extension).
%t Insert a tab.
%w Day of week (Sunday = 0).
%x Country-specific date format based on locale.
%y Last two digits of year (00-99).
%z RFC 822-style numeric time zone.
%A Full weekday.
%B Full month name.
%D Date in %m/%d/%y format.
%H Hour in 24-hour format (00-23).
%I Hour in 12-hour format (01-12).
%M Minutes (00-59).
%S Seconds (00-59).
%T Time in %H:%M:%S format.
%U Week number in year (00-53); start week on Sunday.
%V Week number in year (01-52); start week on Monday.
%W Week number in year (00-53); start week on Monday.
%X Country-specific time format based on locale.
%Y Four-digit year (e.g., 2006).
%Z Time-zone name.

Try to avoid setting variables to names that are also commands.
cp is the copy command; so setting something to cp can create problems.

Also, adjust your date

date '+%Y%m%d'

you have bad M (means minutes) and D (means date)
thus there are extra / characters in your string

thx It worked