Advertisement

03.18.2005 at 06:55AM PST, ID: 21356040
[x]
Attachment Details

$# is not reset when no argument is used

Asked by Dennis98 in Unix Systems Programming

In HP Unix, I have a shell script called test.sh.  In it, I have

echo $#

That is the only line in test.sh.  Run the following in order,

> . test.sh a b
> 2
> . test.sh
> 2
> . test.sh a
> 1
> . test.sh
> 1

Weird.  Anybody knows what is wrong?  Is it a possible bug in HP/Unix?  I think the shell needs to reset $# to 0 when no argument is passed.
Start Free Trial
[+][-]03.18.2005 at 09:15AM PST, ID: 13576448

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2005 at 09:44AM PST, ID: 13576719

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2005 at 12:18PM PST, ID: 13578077

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.19.2005 at 12:08AM PST, ID: 13581294

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Unix Systems Programming
Sign Up Now!
Solution Provided By: tfewster
Participating Experts: 4
Solution Grade: A
 
 
[+][-]03.20.2005 at 02:00PM PST, ID: 13587436

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.21.2005 at 06:33AM PST, ID: 13591403

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.26.2005 at 09:39AM PST, ID: 13636709

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.03.2005 at 07:59AM PST, ID: 15217678

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.03.2005 at 11:04AM PST, ID: 15219347

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.02.2006 at 03:23PM PST, ID: 15594502

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01.15.2006 at 12:10PM PST, ID: 15705992

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32