What does $# stand for?

Showing Answers 1 - 13 of 13 Answers

Muthu

  • Jun 2nd, 2005
 

$# will return the number of parameters that are passed as the command-line arguments.

  Was this answer useful?  Yes

Raj

  • Jul 29th, 2005
 

$# means, number of positional parameters set

Max

  • Jun 15th, 2006
 

Print $#This will return the last command is run successfully or not.If it will return 0 then it ran successfully. And if it will return other then 0 thenThere is some problem

  Was this answer useful?  Yes

Srinivas

  • Aug 10th, 2006
 

I think it is $? not $# which returns the status of the last executed command

cmanne

  • Mar 25th, 2007
 

$# returns the number of parameters that are passed to a shell script
$? returns the exit code of the last executed command (0 : Successful, 1 or other: Failed)

Mo

  • Apr 20th, 2012
 

$# : Stands for counts of the number of the positional parameters passed to a script.

example test.sh 1 2 3 4 5 6 7 , there are 7 paramaters as passed so the count of the $# is 7

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions