Sponsored Content
Full Discussion: Meaning of '$#' in Unix
Top Forums Shell Programming and Scripting Meaning of '$#' in Unix Post 302502800 by fhernu on Wednesday 9th of March 2011 01:35:58 AM
Old 03-09-2011
This means the number of parameters (values) given to the script.
This small example will help you to understand :

Create the scritpt test.sh containing the following lines
echo "1st parameter : $1"
echo "2nd parameter : $2"
echo "3rd parameter : $3"
echo "Number of parameters: $#"
If you execute ./test.sh A B C

The output will be :
1st parameter : A
2nd parameter : B
3rd parameter : C
Number of parameters: 3
If now you execute ./test.sh A B

The output will be :
1st parameter : A
2nd parameter : B
3rd parameter :
Number of parameters: 2
Coming back to your script :

if test $# -eq 1 checks that one parameter is given to the script during its execution. Please notice this doesn't check the content of this parameter.
This User Gave Thanks to fhernu For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Meaning of unix-rt ldp file type

Hello I was wondering what this file type means... assuming it is some type of data. Is ldp - Linux Doc Program? What type of program would be used to read or interpret this file type? As you can see I'm not a developer, and don't review these types of files. But would like to view... (1 Reply)
Discussion started by: jfmrts
1 Replies

2. UNIX for Dummies Questions & Answers

Meaning of ; in UNIX file?

Hello. I'm looking at a file that has a ; at the beginning of certain lines. Could someone please tell me what that means? Is it a comment? Is it an execute? Thank You (1 Reply)
Discussion started by: willdaw3
1 Replies

3. UNIX for Dummies Questions & Answers

Oot: Level 2 Unix Support? meaning

Hi all, I am sorry, I know this is not correct forum/silly question (usually this is requirement in some vacancies), but i hope someone can explain to me, what is the meaning of : SUN Tier 3 Support Tier 3 Application Installation Level 2 Solaris Level 2 AD MOM + DBA Thank you. (0 Replies)
Discussion started by: blesets
0 Replies

4. Shell Programming and Scripting

What is the meaning of $_

Hi, Can somebody tell the usage of "$_" cd $_ ? and ls $_ ? (4 Replies)
Discussion started by: giri_luck
4 Replies

5. Shell Programming and Scripting

Meaning of each term in stty -a in unix

Hi, Can someone help me with the meaning of each term in the below command in unix: stty-aRegds, I have searched google for a lot for this, but didnt get any success in this. Kunwar (2 Replies)
Discussion started by: kunwar
2 Replies

6. UNIX for Dummies Questions & Answers

meaning of <<!

Hi all, I wanna know the meaning of the last word "<<! " sudo su - user <<! please help on this !!!! (1 Reply)
Discussion started by: sudharson
1 Replies

7. UNIX for Dummies Questions & Answers

UNIX Script - snipet meaning?

What would the below code snippet mean? my ($_configParam, $_paramValue) = split(/\s*=\s*/, $_, 2); $configParamHash{$_configParam} = $_paramValue; (2 Replies)
Discussion started by: MaKha
2 Replies

8. UNIX for Beginners Questions & Answers

&& meaning in UNIX

Hi Team, I know that "&" holds the result of current pattern match. But what does "&&" means and its use please? Thanks & Regards, Batta Archana (6 Replies)
Discussion started by: Archana Batta
6 Replies

9. Shell Programming and Scripting

What is the meaning of ## in UNIX shell script?

Hi All, I am new to unix shell scripting and I was documenting one of the unix script and encountered below statements - for ii in `ls -1rt /oracle/admin/MARSCOPY/ext_files/fpm-ifpm/*.small.txt | tail -1 | awk '{print $1}'` do smallssim=${ii##/oracle/admin/MARSCOPY/ext_files/fpm-ifpm/}... (2 Replies)
Discussion started by: shuklajayb4
2 Replies

10. Shell Programming and Scripting

Meaning of $1^

Hello everyone, I'm looking for the meaning of this expression, as I don't understand it quite clearly : $1^ What do you think it could be? I thought either: - match lines starting with argument 1 but it should be ^$1 - turn line around : word becomes drow Thanks in advance for your... (4 Replies)
Discussion started by: bibelo
4 Replies
IFDHSetProtocolParameters(3SMARTCARD)			    Smartcard Library Functions 		     IFDHSetProtocolParameters(3SMARTCARD)

NAME
IFDHSetProtocolParameters - set protocol parameters SYNOPSIS
#include <smartcard/ifdhandler.h> RESPONSECODE IFDHSetProtocolParameters(DWORD Lun, DWORD Protocol, UCHAR Flags, UCHAR PTS1, UCHAR PTS2, UCHAR PTS3); PARAMETERS
The IFDHSetProtocolParameters() function takes the following parameters: Input Lun Logical Unit Number Protocol Desired protocol Flags The bitwise-inclusive OR of the flags PTS1 1st PTS Value PTS2 2nd PTS Value PTS3 3rd PTS Value DESCRIPTION
The IFDHSetProtocolParameters() function sets the Protocol Type Selection (PTS) of the slot or card using the three PTS values as defined in ISO 7816. The Protocol parameter can take an integer value between 0 and 14, inclusive, corresponding to the protocol T=0, T=1, ..., T=14. The Flags parameter can have the value of one of the following or the bitwise-inclusive OR of two or more of the following: IFD_NEGOTIATE_PTS1 Use the PTS1 value. IFD_NEGOTIATE_PTS2 Use the PTS2 value. IFD_NEGOTIATE_PTS3 Use the PTS3 value. RETURN VALUES
The following values are returned: IFD_SUCCESS Successful completion. IFD_COMMUNICATION_ERROR An error occurred. IFD_ERROR_PTS_FAILURE The PTS value could not be set. IFD_PROTOCOL_NOT_SUPPORTED The protocol is not supported. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
IFDHCreateChannelByName(3SMARTCARD), attributes(5) NOTES
This manual page is derived from the MUSCLE PC/SC IFD Driver Developer Kit documentation. License terms and attribution and copyright information for this interface is available at the default location /var/sadm/pkg/SUNWocfh/install/copyright. If the Solaris Operating Environment has been installed anywhere other than the default location, modify the path to access the file at the installed location. SunOS 5.10 4 Dec 2002 IFDHSetProtocolParameters(3SMARTCARD)
All times are GMT -4. The time now is 04:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy