bug-findutils
[Top][All Lists]
Advanced

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

Re: gawk control with board-mechanismen WINDOWS-like MediaName see mount


From: James Youngman
Subject: Re: gawk control with board-mechanismen WINDOWS-like MediaName see mount line
Date: Sat, 2 Apr 2011 21:21:45 +0100

On Mon, Sep 13, 2010 at 8:59 AM, oss <address@hidden> wrote:
> Hello,
>
> if there any bug or what i make wrong ?

You're not quoting the command-line correctly.

> I think, this is a typically bug within spaces in the command, or ...
> The question is: How can i made better ?

I think exec "$cmd_string" would be an improvement.

>
> Cincerally
> Oskar Schömig
>
> address@hidden:~$ ~/bin/myupdatedb
> PROC=myupdatedb
> MEDIA_NAME=media/LM 10 2010
> DOING: sudo updatedb --prunepaths='media/LM 10 2010'
> updatedb: invalid option 10
> Usage: /usr/bin/updatedb [--findoptions='-option1 -option2...']
>       [--localpaths='dir1 dir2...'] [--netpaths='dir1 dir2...']
>       [--prunepaths='dir1 dir2...'] [--prunefs='fs1 fs2...']
>       [--output=dbfile] [--netuser=user] [--localuser=user]
>       [--old-format] [--dbformat] [--version] [--help]
>
> Report bugs to <address@hidden>.
> address@hidden:~$
> address@hidden:~$ nl ~/bin/myupdatedb
>     1  #!/bin/bash
>     2  PROC="$(basename $0)"
>     3  echo PROC=$PROC
>     4  AWK="$(which gawk)"
>
>     5  if [ -d /media/KINGSTON ]; then
>     6     sudo updatedb --prunepaths='/media/KINGSTON'
>     7  else
>     8     mount | grep media 1>&2>/dev/null
>     9     if [ $? = 0 ]; then
>    10        MEDIA_NAME="$(mount | awk '{if(match($0,/media[A-Za-z0-9/
> ]+type/)) printf("%s\n", substr($0,RSTART,RLENGTH-5))}')"
>    11        echo MEDIA_NAME=$MEDIA_NAME
>    12        cmd_string="$(echo sudo updatedb
> --prunepaths=\'${MEDIA_NAME}\')"
>    13        echo "DOING: $cmd_string"
>    14        exec $cmd_string
>    15     else
>    16        sudo updatedb
>    17     fi
>    18  fi
>
>
> address@hidden:~$
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]