Changeset 911

Show
Ignore:
Timestamp:
11/01/06 19:46:51 (4 years ago)
Author:
bruno
Message:

Further removal of all instances of grep -w|-x in code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/stable/contrib/mkcd/setup

    r355 r911  
    150150    fi 
    151151 
    152     res=`cat /etc/issue.net 2>/dev/null | fgrep -i turbolinux | head -n1` 
     152    res=`cat /etc/issue.net 2>/dev/null | grep -i turbolinux | head -n1` 
    153153    if [ "$res" != "" ] ; then 
    154154    echo "$res" 
     
    156156    fi 
    157157 
    158     for fname in `find /etc -maxdepth 1 | fgrep release` /etc/issue.net ; do 
    159         res=`cat $fname 2>/dev/null | fgrep -i "linux" | head -n1 | tr -s '\t' ' '` 
     158    for fname in `find /etc -maxdepth 1 | grep release` /etc/issue.net ; do 
     159        res=`cat $fname 2>/dev/null | grep -i "linux" | head -n1 | tr -s '\t' ' '` 
    160160        [ "$res" = "" ] && res=`cat $fname |head -n1 | tr -s '\t' ' '` 
    161161        if [ "$res" != "" ] ; then 
     
    230230        [ "`echo "$i" | grep mindi`" ] && qq=head || qq=tail 
    231231        j=`find $1/ -type f -maxdepth 1 | grep "$i" | $qq -n1` 
    232         [ ! "$j" ] && j=`find RPMS/ -type f -maxdepth 1 | fgrep "$i" | $qq -n1` 
     232        [ ! "$j" ] && j=`find RPMS/ -type f -maxdepth 1 | grep -F "$i" | $qq -n1` 
    233233        if [ ! "$j" ] ; then 
    234234        echo "Looking for $i" >> /dev/stderr 
     
    254254        if echo "$j" | grep "\-$blah" &> /dev/null ; then 
    255255        k=`echo "$j" | cut -d'-' -f1,2` 
    256         if echo "$j" | grep -x "[A-Z,a-Z]*-[A-Z,a-Z]*-[A-Z,a-z]*-.*" &> /dev/null ; then 
     256        if echo "$j" | grep -E '^[A-Z,a-Z]*-[A-Z,a-Z]*-[A-Z,a-z]*-.*$' &> /dev/null ; then 
    257257            k=`echo "$j" | cut -d'-' -f1,2,3` 
    258258        fi 
     
    279279#    echo "banner = $banner" >> /dev/stderr 
    280280    for i in $banner ; do 
    281     j=`echo $i | grep -x "[v|V][0-9]+*.*"
    282     [ ! "$j" ] && j=`echo $i | grep -x "[0-9]+*.*"
    283     echo "$j" | grep -x "[0-9]*)" > /dev/null && continue 
     281    j=`echo $i | grep -E '^[v|V][0-9]+*.*$'
     282    [ ! "$j" ] && j=`echo $i | grep -E '^[0-9]+*.*$'
     283    echo "$j" | grep -E '^[0-9]*)$' > /dev/null && continue 
    284284    [ "$j" ] && res=`echo $j | sed s/v// | sed s/V//` 
    285285    done 
     
    610610 
    611611StrStr() { 
    612   [ "`echo "$1" | fgrep -i "$2"`" ] && return 0 || return 1 
     612  [ "`echo "$1" | grep -Fi "$2"`" ] && return 0 || return 1 
    613613} 
    614614 
     
    674674echo -en "Do you want to install the (S)table or the (D)evelopment branch of Mondo? " 
    675675read ch 
    676 if [ "`echo "development" | fgrep -i "$ch"`" ] ; then 
     676if [ "`echo "development" | grep -Fi "$ch"`" ] ; then 
    677677    MY_BRANCH=$DEVEL_BRANCH 
    678678    MINDI_BRANCH=1.1 
     
    703703    echo -en "Shall I do that (y/n)? " 
    704704    read ch 
    705     if [ "`echo "YESyesYes" | fgrep "$ch"`" ] ; then 
     705    if [ "`echo "YESyesYes" | grep -F "$ch"`" ] ; then 
    706706        distro=RHT 
    707707        version=7.2 
  • branches/stable/mindi/analyze-my-lvm

    r850 r911  
    9494    allocation=`GetValueFromField $fname "LV Size"` 
    9595    [ ! "`echo "$allocation" | grep "[k,m,g]"`" ] && allocation="$allocation"m 
    96     if echo "$allocation" | grep -x ".*g" > /dev/null 2> /dev/null ; then 
     96    if echo "$allocation" | grep -E '^.*g$' > /dev/null 2> /dev/null ; then 
    9797        val=`echo "$allocation" | sed s/g//` 
    9898        allocation=`echo "$val" | awk '{c=$1; printf "%d", c*1024;}'`m 
     
    169169 
    170170ListLvmDrivesAndPartitions() { 
    171     $LVMCMD vgdisplay -v 2> /dev/null |grep "PV Name" | sed 's/(#)//' | awk '{print $3}' 
     171    $LVMCMD vgdisplay -v 2> /dev/null | grep "PV Name" | sed 's/(#)//' | awk '{print $3}' 
    172172} 
    173173 
  • branches/stable/mindi/aux-tools/sbin/calc-disk-size

    r196 r911  
    2828# ---------------- main --------------- 
    2929 
    30 if [ "$#" -ne "1" ] || [ "`echo "$1" |grep -x "/dev/[a-z]*"`" = "" ]; then 
     30if [ "$#" -ne "1" ] || [ "`echo "$1" |grep -E '^/dev/[a-z]*$'`" = "" ]; then 
    3131    LogIt "calc-disk-size <device>" 1 
    3232    exit 1 
  • branches/stable/mindi/install.sh

    r898 r911  
    3535 
    3636ARCH=`/bin/arch` 
    37 echo $ARCH | grep -x "i[0-9]86" &> /dev/null && ARCH=i386 && locallib=$local/lib 
    38 echo $ARCH | grep -x "x86_64" &> /dev/null && locallib=$local/lib64 
    39 echo $ARCH | grep -x "ia64" &> /dev/null && locallib=$local/lib 
     37echo $ARCH | grep -E '^i[0-9]86$' &> /dev/null && ARCH=i386 && locallib=$local/lib 
     38echo $ARCH | grep -E '^x86_64$' &> /dev/null && locallib=$local/lib64 
     39echo $ARCH | grep -E '^ia64$' &> /dev/null && locallib=$local/lib 
    4040export ARCH 
    4141 
  • branches/stable/mindi/rootfs/sbin/init

    r898 r911  
    239239        [ -d "/proc/1" ] || mount -n /proc 
    240240        LogIt "Kernel support found. Creating config file and starting devfsd" 
    241         conffile=`strings $loc | grep "devfsd.conf$"` 
     241        conffile=`strings $loc | grep -E "devfsd.conf$"` 
    242242        [ "$conffile" ] || conffile="/etc/devfsd.conf" 
    243243        confpath=`echo $conffile | sed "s/\/devfsd\.conf$//"` 
  • branches/stable/mondo/src/common/libmondo-archive.c

    r908 r911  
    736736    strcpy(scratchdir, bkpinfo->scratchdir); 
    737737    sprintf(tmp, 
    738             "echo '%s' | tr -s ' ' '\n' | grep -x '/dev/.*' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", 
     738            "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", 
    739739            bkpinfo->exclude_paths); 
    740740    strcpy(devs_to_exclude, call_program_and_get_last_line_of_output(tmp)); 
     
    38843884*/ 
    38853885        sprintf(tmp, 
    3886                 "grep 'afio: ' %s | sed 's/afio: //' | grep -vx '/dev/.*' >> /tmp/changed.files", 
     3886                "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> /tmp/changed.files", 
    38873887                MONDO_LOGFILE); 
    38883888        system(tmp); 
    38893889 
    38903890        sprintf(tmp, 
    3891                 "grep 'star: ' %s | sed 's/star: //' | grep -vx '/dev/.*' >> /tmp/changed.files", 
     3891                "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> /tmp/changed.files", 
    38923892                MONDO_LOGFILE); 
    38933893        system(tmp); 
  • branches/stable/mondo/src/common/libmondo-tools.c

    r909 r911  
    625625    strcpy(tmp, 
    626626           call_program_and_get_last_line_of_output 
    627            ("free | grep \":\" | tr -s ' ' '\t' | cut -f2 | head -n1")); 
     627           ("free | grep ':' | tr -s ' ' '\t' | cut -f2 | head -n1")); 
    628628    avm += atol(tmp); 
    629629    sprintf(command, "mount /dev/shm -t tmpfs %s -o size=%d%c", 
     
    13961396    log_msg(4, "Done. Great. Seeting command to something"); 
    13971397    strcpy(command, 
    1398            "grep -v \":\" /etc/fstab | grep -vx \"#.*\" | grep -E \"[     ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1"); 
     1398           "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[     ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1"); 
    13991399    log_msg(4, "Cool. Command = '%s'", command); 
    14001400    strcpy(tmp, call_program_and_get_last_line_of_output(command)); 
     
    14101410            } 
    14111411        } else { 
    1412             sprintf(command, "mount | grep -E \"^%s\"", tmp); 
     1412            sprintf(command, "mount | grep -E '^%s'", tmp); 
    14131413            log_msg(3, "command = %s", command); 
    14141414            if (run_program_and_log_output(command, 5)) { 
     
    14861486           ("mktemp -q /tmp/mojo-jojo.blah.XXXXXX")); 
    14871487    if (does_file_exist(config_file)) { 
    1488         sprintf(command, "grep -vx '%s .*' %s > %s", 
     1488        sprintf(command, "grep -vE '^%s .*$' %s > %s", 
    14891489                label, config_file, tempfile); 
    14901490        paranoid_system(command); 
  • branches/stable/mondo/src/common/libmondo-verify.c

    r543 r911  
    165165    log_msg(1, "Now scanning log file for 'afio: ' stuff"); 
    166166    sprintf(command, 
    167             "grep \"afio: \" %s | sed 's/afio: //' | grep -vx \"/dev/.*\" >> %s", 
     167            "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", 
    168168            stderr_fname, afio_found_changes); 
    169169    log_msg(2, command); 
     
    175175    log_msg(1, "Now scanning log file for 'star: ' stuff"); 
    176176    sprintf(command, 
    177             "grep \"star: \" %s | sed 's/star: //' | grep -vx \"/dev/.*\" >> %s", 
     177            "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s", 
    178178            stderr_fname, afio_found_changes); 
    179179    log_msg(2, command); 
     
    11491149            (int) (random() % 32767)); 
    11501150    sprintf(tmp, 
    1151             "grep -x \"%s:.*\" %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"dev/.*\"  > %s", 
     1151            "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$'  > %s", 
    11521152            (bkpinfo->use_star) ? "star" : "afio", MONDO_LOGFILE,  
    11531153            changed_files_fname); 
  • branches/stable/mondo/src/mondorestore/mondo-restore.c

    r818 r911  
    31063106    fatal_error("This will fail"); 
    31073107    sprintf(command, 
    3108             "grep -x \"%s.*\" %s > %s", 
     3108            "grep -E '^%s.*$' %s > %s", 
    31093109            restore_this_directory, g_filelist_full, g_filelist_full); 
    31103110    if (system(command)) { 
     
    31163116    fatal_error("This will fail"); 
    31173117    sprintf(command, 
    3118             "grep -x \"%s.*\" %s > %s", 
     3118            "grep -E '^%s.*$' %s > %s", 
    31193119            restore_this_directory, g_biggielist_txt, g_biggielist_txt); 
    31203120    if (system(command)) { 
  • branches/stable/mondo/src/restore-scripts/mondo/make-me-bootable

    r680 r911  
    4242    partno=$root_part 
    4343else 
    44     driveline=`grep -w /boot $1` 
    45     [ ! "$driveline" ] && driveline=`grep -w / $1` 
     44    driveline=`grep -E '[  ]/boot[     ]' $1` 
     45    [ ! "$driveline" ] && driveline=`grep -E '[    ]/[     ]' $1` 
    4646    partno=`echo "$driveline" | cut -d' ' -f1 | awk -F "[a-z]" '{print $NF;}'` 
    4747#    echo "driveline=$driveline --> partno=$partno"