"too many arguments" message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmvidalvia
    New Member
    • Oct 2007
    • 2

    #1

    "too many arguments" message

    Hi everybody!
    My first post here...hope to learn quickly.
    I just mounted a debian server and start to run some few scripts. They "seem" to run, but sometimes (5% of times) I am getting this error message:

    Code:
    /home/jmd/sh/cartas.sh: line 2: [: too many arguments
    This is /home/jmd/sh/cartas.sh:
    Code:
    #!/bin/bash
    if [ -z $(ls /home/as400/cartas) ]
    then
            echo "" > /dev/null
    else
            /home/jmd/sh/cartastxt.sh
    fi
    And this is /home/jmd/sh/cartastxt.sh
    Code:
    #!/bin/bash
    touch /home/as400/cartas/prueba.txt
    chown nobody:desa /home/as400/cartas/*
    chmod 660 /home/as400/cartas/*
    mv /home/as400/cartas/* /home/datos/comercial/cartas/
    rm /home/datos/comercial/cartas/prueba.txt
    What is driving me crazy is that messages just appear sometimes.
    Youy might know that files are send to /home/as400/cartas from a IBM iseries using ftp.
    Thank you very much for your help!
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    You are getting an the error "Too many arguments" on this line:

    if [ -z $(ls /home/as400/cartas) ]

    What are you trying to do here? What could the message be referring to as arguments?

    Comment

    Working...