@Lavya I had copied the list from here which did not include !. The ! was added in a later edit by Gilles who forgot to add it to the first list. I have now done so.
So, yes, as far as I know, ! is also an operator.
My guess is that they simply forgot to include it in the list, I don't see what else it can be if it's not an operator.
Section 3.2.4.2 of the bash manual does actually call it an operator:
> Expressions may be combined using the following operators, listed in decreasing order of precedence:
might it be that they mean "arithmetic operator" as described in section 6.5 (or some other kind that I'm not aware of yet), instead of bash control operators..?
@terdon also, while trying on the shell itself, "!' seems to have some other function - it expands the command by comparing it with commands from history , so I haven't been able to use it as a control operator as in the case of say && and ||
by typing something like say !true && echo hello . do you have an idea how we can use it as one..?
@Lavya Ah, no there it is interpreted as a history command. You can do things like this:
$ foo="aa"
$ [ ! "$foo" = "bb" ] && echo "foo is not bb"
foo is not bb
It negates the command in the [ ] construct.
It is essentially equivalent to a not so the only thing you can call it is a control operator but it can only be used ins specific contexts and that complicates the terminology. I don't really know what to call it and control operator is probably the best choice.
@terdon thanks! but I suppose that should come under "[" which is a builtin command under shell, not the shell itself. I have to admit though that I am a bit confused at the moment so instead of bothering you with the definitions even more, I think I should go through the manual and try things out a bit. Thank you so much once again for taking the time and replying impromptu!
@Lavya You're very welcome. You might very well be right and the ! is only an operator inside the test builtin. I'll have to think about whether there are any other examples.