Can function names have hyphens?

Can function names have hyphens?

The following shells are known not to support hyphens in function names: ash (busybox), csh, tcsh, dash.

What is hyphen in terminal?

4. One hyphen is the way options to a command traditionally has been given to Unix-commands. They have one hypen followed by a single letter (or sometimes number) ( -a -i -T ). Some options are followed by an argument ( -ofilename -o filename ).

Can you write functions in bash?

Bash provides some built-in functions such as echo and read , but we can also create our own functions.

Can you use a hyphen in python?

Python packages and modules can not use hyphens, only underscores. Underscores can be used in the module name if it improves readability.

What’s the use of a hyphen?

A hyphen (-) is a punctuation mark that’s used to join words or parts of words. It’s not interchangeable with other types of dashes. Use a hyphen in a compound modifier when the modifier comes before the word it’s modifying.

What is $_ bash?

$_ $_ (dollar underscore) is another special bash parameter and used to reference the absolute file name of the shell or bash script which is being executed as specified in the argument list. This bash parameter is also used to hold the name of mail file while checking emails.

What is S in shell script?

-S filename ] can be read as “not is-socket filename”. So the command is checking whether a “socket” (a special kind of file) exists with each name in the loop. The script uses this command as the argument to an if statement (which can take any command, not just [ ) and sets DOWN to true if any of them does not exist.

What does hyphen mean in bash?

Historically, shells accepted a single hyphen to mean much the same. A bash shell interprets a single-hyphen specially in argument list-contexts. With set , for example it marks the end of options and disables -v erbose and -x trace.

Can a shell variable name include a hyphen?

So if you need to pass a variable whose name contains special character to a program, pass it directly, without a shell in between ( env ‘strange-name=some value’ sh -c’…; myprogram’ may or may not work). That’s not possible in Bash.

When to use’-‘in a function name in Bash?

Bash does allow ‘-‘ to appear in function names. I do this all the time. For example: A ‘word’ consisting solely of letters, numbers, and underscores, and beginning with a letter or underscore. ‘Name’s are used as shell variable and function names.

Can you use extended Unicode characters in Bash?

Using extended Unicode characters is (no-doubt) useful for many users. But bash, mksh, lksh, and zsh seem to allow it. I am aware that POSIX valid function names use this definition of Names.

What are the identifiers and blanks in Bash?

A blank is a tab or a space. An identifier is a sequence of letters, digits, or underscores starting with a letter or underscore. Identifiers are used as components of variable names. A vname is a sequence of one or more identifiers separated by a . and optionally preceded by a .. Vnames are used as function and variable names.