Skip to content
Advertisement

Linux bash ‘[: -ge: unary operator expected’ error

JavaScript

I tried this code and it gives many errors that

JavaScript

could anyone help me to fix this problem please.

Advertisement

Answer

The source of the problem reported in the question is an empty decvalue as syme has already stated.

Considering the purpose of the script, it seems you attempted to write a recursive function. For this reason, i suggest you to follow the comment under your question by jww regarding debugging!

Moreover, you are encouraged to search for questions on recursive functions in bash on SO. There are excellent answers for factorial computations in bash.

Think about which quantities are “transported” and which are returned/compiled in the end.


If you are really stuck, you find 90% of the solution below.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement