How to define two variable x=20, y=5 and then to print division of x and y (i.e. x/y) bash script
I tried this but i am getting error:
ubuntu@ubuntu-VirtualBox:~/Documents$ x=20
ubuntu@ubuntu-VirtualBox:~/Documents$ y=5
ubuntu@ubuntu-VirtualBox:~/Documents$ expr x / y
expr: non-integer argument 1 1 Answer
You need to add $ in front of a variable name to refer to its contents.
pilot6@Pilot6:~$ x=20
pilot6@Pilot6:~$ y=5
pilot6@Pilot6:~$ expr $x / $y
4