I have a script file like this:
#!/bin/bash
clear
echo "The script starts now."
echo "Hi, user!"
echo
echo "I will now fetch you a list of connected users:"
echo
w
echo "I'm setting two variables now."
COLOUR="black"
VALUE="9"
echo "This is a string: $COLOUR"
echo "And this is a number: $VALUE"
echo
I observed that the effect of w is that it prints the following:
18:06:36 up 7:43, 3 users, load average: 0.40, 0.56, 0.64
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
hes tty7 10:23 7:43m 12:31 0.96s gnome-session -
hes pts/0 :0 15:41 4.00s 1.38s 11.46s gnome-terminal
hes pts/2 :0 17:20 44:52 0.79s 11.46s gnome-terminal
when I typed echo " statement" in terminal , it prints the statement. But I could not understand w here. in terminal echo w , prints w not as above. Can someone help me in understanding how this work?
man w
– andr3w Jan 6 '14 at 12:52declare -i
does not change type, it just artificially adds limitations. – Chris Down Jan 6 '14 at 13:08