bash_completion: properly find out CTID for --ipdel/--netif_del

Due to the fact that there can be an optional global option
(like --verbose or --quiet) in a vzctl invocation, the position
of CTID field may change (in "vzctl set 123" the CTID position is 2,
while in "vzctl --quiet set 123" it is at 3). Because of that this
script used a logic to find out that we really got a CTID by looking
if it's a number or not. This check is not working if CTID is a name!

So switch to different logic -- if first argument starts with "--",
this means that it is a global option, therefore take the third argument
as CTID, otherwise take the second one.

We only need CTID for --ipdel and --netif_del set options.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed