I have to create the function in shell script, that function name must contain the special characters. like
>() { echo $1 $2 } Here my function name is >, If its possible how can I give, Like above I tried that But it will through the error
Most shells restrict the name of functions to contain only characters that don't need to be quoted, which excludes >.
Even in the few shells that allow > as a function name (I only know of zsh), defining a function called > would only have an effect if you called > as a command (which would require quoting it, i.e. running \> or ">" or '>'). It would not change how redirection works.
None of the usual shells have a way to configure what happens if some subsequent part of the script performs a redirection. If you need that kind of things, a shell is not nearly a flexible enough language. But there's probably a better way to solve whatever problem you're trying to solve — and quite possibly one that can be solved in a shell script.
The > has a special meaning in the shell, it's a redirection operator, see the manpage:
[n]> file Redirect standard output (or n) to file.
The name of a function can contain only letters (a-z or A-Z), digit (0-9) or the underscore character (_). Also is must not begin with a digit. (see Function Definition Command and Name)
>?bashaccepts only one argument after>so why do you use$1and$2? The answer to your actually question is probably actually no, but it is not yet clear what you really want to achieve.>is not a solution, if you explain what you are trying to do, we might be able to help you find another way.