Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I do this:

set foo bar baz
unset # Something else here
echo $# # Should ouput 0

By doing set "", $# will still be 1 and not 0.

share|improve this question
up vote 3 down vote accepted

Ok this was just stupid, and I found out using set -- will work.

share|improve this answer
@Gilles: According to the bash man page, set - with no arguments leaves the positional parameters unchanged. – camh Aug 19 '11 at 3:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.