Question about a VIM script from a absolute noob

What is this script meant to do? How do I make it executable and how do i run it? I am trying to understand what the script is doing and how it is doing it... need a little advice. Here is is..

if [ -n "$user"  ]
 then
   list=`w | grep $user | cut -c19-30` 
  if [  "$list" != "" ] 
  then 
    echo "The user $user is logged
  in from $list"
    else
      echo "The user $user is not
 logged in now"
     fi
  fi

run the follows on your environment. ( not sure which one is correct $user or $USER in your environment)

# echo $user
# echo $USER
# w | grep $user | cut -c19-30

You will get an idea what it is meant to do.

Cheers,

1 Like

@Joseph TKLee: Thank you for such a quick response. I created this script.. err rather copied it.. in my bin directory, which is completely empty, save for this script. I am going out on a limb here but I am guessing my directory should have a list of users somewhere inside in order for it to work properly? (apologies.. I am about as new to this as it gets.)

---------- Post updated at 11:11 PM ---------- Previous update was at 11:03 PM ----------