mb47
mb47

Reputation: 303

What does if [[ $# -ge 1 ]] mean in shell scripting

I was going over some files and found this:

if [[ $# -ge 1 ]]

What does that mean?

Upvotes: 12

Views: 40815

Answers (3)

Ayler
Ayler

Reputation: 21

It means:

if param_numbers >=1

Upvotes: -1

Krishna
Krishna

Reputation: 179

In shell script $# stores the number of arguments passed from the command line, like *argc in c programming.

So, By using the "if" statement we are verify the number of arguments are greater than or equal to one.

Upvotes: 5

Jeff Puckett
Jeff Puckett

Reputation: 40971

if the number of passed parameters is greater than or equal to 1

Upvotes: 19

Related Questions