getting value from field dynamically

how i do pass in field number when cutting, I tried to do this:

but it says 11-1: not found

$ var=1
$ echo $((var+1))
2
$ echo `expr $var + 1`
2
$ echo "$var + 1" | bc 
2

it says ranges must be increasing..you mean you can't do a decrement?

a=1
b=5
echo $line | tr -s " " | cut -d " " -f$a-$b

$ tmp="ABC 123 XYZ 890"
$ t=3
$ echo $tmp | cut -d" "  -f $(echo $t)
XYZ
$ echo $tmp | cut -d" "  -f $(expr $t - 1)
123
$

is it possible to do it without using two variables? i want to get last two fields of the line

echo 'a b c d e f' | cut -d' ' -f 4-

I try to do this

but it says cannot cut 11

i check, but there's 11 word after cutting out the " " delimiter

Are there spaces in $lessOneWordOfVessel and/or $totalWordOfVessel? How are you calculating them?

vnix$ echo "foo bar baz quux" | cut -d " " -f1 -2  # space after 1
cut: invalid option -- 2
Try `cut --help' for more information.
-bash: echo: write error: Broken pipe
vnix$ echo "foo bar baz quux" | cut -d " " -f1- 2  # space before 2
cut: 2: No such file or directory
-bash: echo: write error: Broken pipe
vnix$ echo "foo bar baz quux" | cut -d " " -f1-2  # no spaces
foo bar

i want to cut the last two fields of the line

the line has 11 fields after the delimiter
so in actual fact i trying to cut 10th and 11th field of the line

So do the variables really contain just the numbers 10 or 11, or can there be spaces on either side? If you have spaces there, it will not work.

BUNGA TERATAI 3    5055     ITH      1     0     0     0     1     1

this is what i want to extract out, i want the value at the last two fields

i can't really test the variable, since it give me error in the first place

awk '{ print $(NF-1), $NF }' file

You can inspect the value of all variables with set; usually you can also use echo regardless of what the variable contains, although you should be aware that some versions of echo will not print the raw string exactly (there's backslash escaping, etc.) and of course, you have to

[quote it properly]
(UNIX Shell Quotes - a simple tutorial) to see whether or not there's any whitespace there.