Bash: Too many arguments

后端 未结 1 671
情书的邮戳
情书的邮戳 2020-12-10 19:33

I\'ve coded the following script to add users from a text file. It works, but I\'m getting an error that says \"too many arguments\"; what is the problem?

#!         


        
相关标签:
1条回答
  • 2020-12-10 19:53

    Use quotes. Liberally.

    if [ "$ENROLSTAT" = Complete ]
    

    (It's a single equal sign, too.) My greatest problem in shell programming is always hidden spaces. It's one of the reasons I write so much in Perl, and why, in Perl, I tell everyone on my team to avoid the shell whenever running external programs. There is just so much power in the shell, with so many little things that can trip you up, that I avoid it where possible. (And not where not possible.)

    0 讨论(0)
提交回复
热议问题