This is probably a really dumb question, but I don’t know what if [ ! -n "$1" ] means, if not more than one argument do… so I get how it works, but what is -n is it the abbreviation of number?
I’ve been reading through The Advanced Bash programming guide and they just start using it. I’ve tried to find it and come up with it must be a "built-in" default parameter. Is there a command to show default parameters in Linux?
The
-nargument totest(aka[) means “is not empty”. The example you posted means “if$1is not not empty. It’s a roundabout way of saying[ -z "$1" ];($1is empty).You can learn more with
help test.$1and others ($2,$3..) are positional parameters. They’re what was passed as arguments to the script or function you’re in. For example, running a script namedfooas./foo bar bazwould result in$1 == bar,$2 == baz