This article was reproduced from: Http://yejinxin.github.io/parse-shell-options-with-getopt-commandIn a previous article, we described how to use the shell's built-in getopts command to help us with Shell scripting options and parameters, with the
Transferred from: https://www.cnblogs.com/qingergege/p/5914218.htmlRecently in the Linux C programming, undergraduate time did not study well, hope to learn younger brothers learn lesson.Well, it's a bit verbose, but it's really a piece of advice.
The shell getopts and getopt usage 1.getoptsgetopts (shell built-in command) cannot directly handle long options (such as:--prefix=/home, etc.), Getopts has two parameters, the first parameter is a string, including characters and ":", each
Getopt/getopts: command line option/parameter processing in Bash 0. When writing a program, you must always process command line parameters. This article describes the command line Processing Method in Bash. Options and parameters: for example, the
The following is an example of how the Python getopt module processes command line options.
In python programming, the getopt module is as flexible and practical as the getopt parameter module in shell.
The getopt module is used to extract command
The Bash shell provides a number of different ways to get data from users, including the following 3 methods:
Command line arguments (data added in the back of fame)
command-line Options (single letter with modifiable command behavior)
To become a flexible tool, a qualified script must provide additional information to describe the role of the script, how it is executed, and where it is executed. Like the command, the script also uses parameters. Switches and parameters increase
Question Description: How do you deal with command-line options such as Tail-n Access.log in a Linux shell?
In bash, command line arguments can be handled in three ways, each with its own scenario.
1, direct processing, in turn to the $1,$2,..., $n,
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.