Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I get the following errors when I execute "ifcfg eth0" on my Red Hat Linux 8.0 installation. Any ideas what is wrong with it? /sbin/ifcfg: line 25: [: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    8

    ifcfg producing "too many arguments" errors


    Hi all,

    I get the following errors when I execute "ifcfg eth0" on my Red Hat Linux 8.0 installation. Any ideas what is wrong with it?

    /sbin/ifcfg: line 25: [: too many arguments
    /sbin/ifcfg: line 26: [: -ge: unary operator expected
    /sbin/ifcfg: line 27: [: -ge: unary operator expected
    /sbin/ifcfg: line 28: [: -ge: unary operator expected


    Best Rgds,

    Steven.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    There seems to be a bug in ifcfg. If you take a look at line 24 & 25, they look as this:
    Code:
    class=${1%%:.*}
    if [ "$1" = "" -o $class -eq 0 -o $class -ge 224 ]; then return 0
    This in effect means that if the enclosing function (ABCMaskLen), is called without parameters or with a null parameter, it will fail since line 25 expands to this:
    Code:
    if [ "" = "" -o -eq 0 -o -ge 224 ]; then return 0
    As you can see, the -eq and -ge binary operators get no left operand, which makes the [ command spit out errors and abort.
    Fix it by replacing line 25 with the following two lines:
    Code:
    if [ "$1" = "" ]; then return 0; fi
    if [ $class -eq 0 -o $class -ge 224 ]; then return 0
    Although this is all possible to fix, are you really sure that it's really ifcfg and not ifconfig that you want?

  3. #3
    Linux Enthusiast
    Join Date
    Jun 2002
    Location
    San Antonio
    Posts
    621
    Great digging Dolda, you are putting me to shame answering all these questions and such I haven't been around much lately, working 40 hours this week, and going to school for 18 credit hours (6 classes, all senior level, very difficult). So I am lacking sleep, and don't get out here to help people out lately. Thanks for picking up my slack
    I respectfully decline the invitation to join your delusion.

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I've noticed... after all, I broke 1000 posts before you did ;-) I never thought that possible when I first returned to this forum and had like 150 posts while you had over 500.
    But the less you've done, the more there is left for me, and after all, most questions are a lot of fun to answer. I'm beginning to suspect that I spend all too much time here, though. I get all too little done on my private projects.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •