Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.