[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gawk control with board-mechanismen WINDOWS-like MediaName see mount lin
From: |
oss |
Subject: |
gawk control with board-mechanismen WINDOWS-like MediaName see mount line |
Date: |
Mon, 13 Sep 2010 09:59:45 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6 |
Hello,
if there any bug or what i make wrong ?
I think, this is a typically bug within spaces in the command, or ...
The question is: How can i made better ?
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:~$
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gawk control with board-mechanismen WINDOWS-like MediaName see mount line,
oss <=