Bash Getopts-Allow your script to support command line parameters
In the past, I always wanted to know how to create command line parameters for my Bash script. After searching, I found two functions that can solve this problem: the getopt function
The getopts parsing command line parameter getopts command is built in shell. you can get the valid command line parameters specified by a single character. each character has a & amp; lsquo; -& amp; rsquo; No. or & amp; lsquo; + & amp; rsquo; No.
Transferred from: http://yejinxin.github.io/parse-shell-options-with-getopts-command/Standard UNIX commands generally offer a number of options, with the user providing specific options and parameters, in the form of a command line, as
Find a very detailed Linux shell script tutorial, in fact, not only the shell script programming, but also introduced the system of various commandsHttp://vdisk.weibo.com/s/yVBlEojGMQMpvThis book is divided into five parts, in detail the shell
We have discussed how to use a specific variable $1 $9 to pass parameters to the script. $ Is used to count the number of passed parameters. You can create a usage statement to notify you how to call a script or function with appropriate parameters
Options for UNIX types: UNIX has the advantage that standard UNIX commands have the same command-line format at execution time: command-options parameters if the shell is executed in the same format, the Bourne shell provides a A statement that
Focus on Listing 7Now, many Linux® and UNIX® systems have bash shells, which are the common default shells on Linux. In this article, you'll learn how to handle parameters and options in a bash script, and how to use the shell's parameter extensions
Python,perl,bash command line parameter part Idaily recurring and perl,python,bash dealings, but often confused between them, on the command line of the special and index differences, Python is really humanized, but the command line is very
Directory
Part 1. Warm up
Why use shell programming?
Start with a sha-bang (Sha-bang refers #!)
Call a script
Preliminary exercises
Part 2. Basics
Special characters
Introduction to variables and parameters
Variable
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.