the script is working fine. How did you copy this script? Through copy and
paste from the web? If so, then check out newlines. Below is the working
script.

#!/bin/sh
#
# rc.autofs - Starts the filesystem automounter
# Last modified 12-Dec-2000 by David Cantrell, <[EMAIL PROTECTED]>
#
#
# This function will build a list of automount commands to execute in
# order to activate all the mount points. It is used to figure out
# the difference of automount points in case of a reload
#
function getmounts()
{
   # Check for local maps to be loaded
   if [ -f /etc/auto.master ]
   then
      cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| (
         while read dir map options
         do
            if [ ! -z "$dir" -a ! -z "$map" \ -a xcho "$map" | cut -c1 !=
'x-' ]
            then
               map=cho "/etc/$map"|sed -e 's:^/etc//:/:'options=cho
"$options" | sed -e 's/\(^\|[ \t]\)-/\1/g'
               if [ ! -d $dir ]
               then
                  mkdir -p $dir
               fi

               if [ -x $map ]
               then
                  echo "/usr/sbin/automount $dir program $map $options
$localoptions"
               elif [ -f $map ]
               then
                  echo "/usr/sbin/automount $dir file $map $options
$localoptions"
               else
                  echo "/usr/sbin/automount $dir ^Basename $map $options
$localoptions"
               fi
            fi
         done )
   fi

   # Check for NIS maps to be loaded
   if [ -e /usr/bin/ypcat ] && [ -pcat -k auto.master 2>/dev/null |
wc -l -gt 0 ]
   then
      ypcat -k auto.master | (
         while read dir map options
         do
            if [ ! -z "$dir" -a ! -z "$map" \
                 -a xcho "$map" | cut -c1 != 'x-' ]
            then
               map=cho "$map" | sed -e 's/^auto_/auto./'
               if echo $options | grep -- '-t' >/dev/null 2>&1
               then
                  mountoptions="--timeout $(echo $options | \sed
's/^.*-t\(imeout\)*[ \t]*\([0-9][0-9]*\).*$/\2/g')"
               fi
               options=echo "$options" | sed -e ' s/--*t\(imeout\)*[
\t]*[0-9][0-9]*//g s/\(^\|[ \t]\)-/\1/g'
               if [ ! -d $dir ]
               then
                  mkdir -p $dir
               fi
               echo "/usr/sbin/automount $dir yp $map $options
$localoptions"
            fi
         done )
   fi
}
getmounts | sh
#----------------


----- Original Message -----
From: "Battery Acid" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, August 13, 2003 9:08 AM
Subject: Re: [autofs] AutoFS and slackware 9.0


> here's the errors:
> ./rc.autofs: line 20: [: missing `]'
> cut: !=: No such file or directory
> cut: x-: No such file or directory
> cut: ]: No such file or directory
> wc: invalid option -- g
> Try `wc --help' for more information.
> and here's the script in the /etc/rc.d/ dir named rc.autofs
> #!/bin/sh
> #
> # rc.autofs - Starts the filesystem automounter
> # Last modified 12-Dec-2000 by David Cantrell, <[EMAIL PROTECTED]>
> #
>
> #
> # This function will build a list of automount commands to execute in
> # order to activate all the mount points. It is used to figure out
> # the difference of automount points in case of a reload
> #
> function getmounts()
> {
>    # Check for local maps to be loaded
>    if [ -f /etc/auto.master ]
>    then
>       cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| (
>          while read dir map options
>          do
>             if [ ! -z "$dir" -a ! -z "$map" \ -a xcho "$map" | cut -c1 !=
> 'x-' ]
>             then
>                map=cho "/etc/$map" | sed -e 's:^/etc//:/:'
> options=cho "$options" | sed -e 's/\(^\|[ \t]\)-/\1/g'
>                if [ ! -d $dir ]
>                then
>                   mkdir -p $dir
>                fi
>
>                if [ -x $map ]
>                then
>                   echo "/usr/sbin/automount $dir program $map $options
> $localoptions"
>                elif [ -f $map ]
>                then
>                   echo "/usr/sbin/automount $dir file $map $options
> $localoptions"
>                else
>                   echo "/usr/sbin/automount $dir asename $map $options
> $localoptions"
>                fi
>             fi
>          done )
>    fi
>
>    # Check for NIS maps to be loaded
>    if [ -e /usr/bin/ypcat ] &&
>       [ pcat -k auto.master 2>/dev/null | wc -l -gt 0 ]
>    then
>       ypcat -k auto.master | (
>          while read dir map options
>          do
>             if [ ! -z "$dir" -a ! -z "$map" \
>                  -a xcho "$map" | cut -c1 != 'x-' ]
>             then
>                map=cho "$map" | sed -e 's/^auto_/auto./'
>                if echo $options | grep -- '-t' >/dev/null 2>&1
>                then
>                   mountoptions="--timeout $(echo $options | \sed
> 's/^.*-t\(imeout\)*[ \t]*\([0-9][0-9]*\).*$/\2/g')"
>                fi
>
>                options=cho "$options" | sed -e '
>                   s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
>                   s/\(^\|[ \t]\)-/\1/g'
>                if [ ! -d $dir ]
>                then
>                   mkdir -p $dir
>                fi
>
>                echo "/usr/sbin/automount $dir yp $map $options
> $localoptions"
>             fi
>          done )
>    fi
> }
>
> getmounts | sh
>
>
> i'm not really good with coding and i found this script on google thanks
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
>



_______________________________________________
autofs mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to