title: how to get the last login time for all users in one line for different shells
body: <p>I can make the following line work on ksh</p>
  
  <pre><code>for user in $( awk -F: '{ print $1}' /etc/passwd); do last $user | head -1 ; done | tr -s "\n" |sort
  </code></pre>
  
  <p>But I'd like to make it work on UNIX sh and UNIX csh. (in linux sh it runs fine, but linux is not unix...)</p>
  
  <p>I know there are limitations for this since it seems that each UNIX(*) has its own variations on the syntax.</p>
  
  <p>update: sorry, there are some restrictions here:</p>
  
  <ol>
  <li>I can't write on the disk, so I can't save scripts.</li>
  <li>how do i write this in CSH?</li>
  </ol>