Listing time every second as a Bash script
        Posted  
        
            by Caleb
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Caleb
        
        
        
        Published on 2010-05-02T03:31:08Z
        Indexed on 
            2010/05/02
            3:37 UTC
        
        
        Read the original article
        Hit count: 404
        
Hello all, first time here as I've finally started to learn programming. Anyway, I'm just trying to print the time in nanoseconds every second here, and I have this:
#!/usr/bin/env bash
while true;
do
 date=(date +%N) ;
 echo $date ;
 sleep  1 ;
done
Now, that simply yields a string of date's, which isn't what I want. My learning has been rather messy, so I hope you'll excuse me for this if it's really simple. Also, I did manage to fine this, that worked on the prompt:
while true ; do date +%N ; sleep 1 ; done
But that obviously doesn't work as a script.
© Stack Overflow or respective owner