- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Number and name of parameters given for a function...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2005 03:47 AM
тАО12-29-2005 03:47 AM
i'd like to remember how do you kwno number of elements given in a function?
for example:
we suppose function is named "find_words"
and find_word requires some parameters:
root@user1> find_words lettera letterb letterc letterd
i do not remember how to know the number and parameters given when find_words in invoked,
i think is like $? $#, i do not remember..
before the script work is neccesary verify if all parameters are given and if they are name correct ..
could you help me please?
thanks, Manuales.
Solved! Go to Solution.
- Tags:
- variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2005 03:51 AM
тАО12-29-2005 03:51 AM
Re: Number and name of parameters given for a function ...
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2005 03:52 AM
тАО12-29-2005 03:52 AM
Re: Number and name of parameters given for a function ...
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2005 03:54 AM
тАО12-29-2005 03:54 AM
SolutionThe number of arguments passed to a function is known with '$#'. Unfortunately, in HP-UX the *name* of the function executing doesn't differ from the global name. Consider:
cat /tmp/fct
#!/usr/bin/sh
echo "$0 saw $# arguments"
function myf
{
echo "...but $0 saw $# arguments..."
}
myf what did he see
exit 0
/tmp/fct one two three
/tmp/fct saw 3 arguments
...but /tmp/fct saw 4 arguments...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2005 03:57 AM
тАО12-29-2005 03:57 AM
Re: Number and name of parameters given for a function ...
Remember, the manpages are your best friend! The ones for 'sh-posix' or 'ksh' provide a tremendous reference:
http://www.docs.hp.com/en/B2355-60103/sh-posix.1.html
http://www.docs.hp.com/en/B2355-60103/ksh.1.html
Regards!
...JRF...