[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: About Shell proggramming.



On 27-May-2002 Squirrel wrote:
> apt_dest()
> {
>       local m="$3"
>       m="debootstrap.invalid"
>       printf "$APTSTATE/lists/"
>       echo "${m}_$4"|sed 's/\//_/g'
> }
> 
> apt_dest rel woody file:/instmnt dists/woody/Release

each argument is passed in as a number parameter.   So $3 is the third
argument.
 
> 
> what's the meaning of the above program,especial of "echo "${m}_$4"|sed
> 's/\//_/g"?
> 

sed is a utility which reads input and does modifications to it then outputs it.

thr s///g means "do a string substitute with this regex on all occurances of
the regex".  The item in between the first // is "\/" which is a backslash
escaped, the item in the second // is '_'.  So this says send the fourth
command line parameter into sed, changing all backslashes into underscores.


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: