Aug 7, 2003 #1 jestrada101 Technical User Joined Mar 28, 2003 Messages 332 How can I read the date/time information and pass into a shell variable? Many thanks je
Aug 7, 2003 1 #2 pavNell Technical User Joined Sep 27, 2002 Messages 178 Location US #!/bin/sh todaysDate=`date` echo "$date" date has several options to choose from. read the man page. type man date Upvote 0 Downvote
#!/bin/sh todaysDate=`date` echo "$date" date has several options to choose from. read the man page. type man date
Aug 7, 2003 Thread starter #3 jestrada101 Technical User Joined Mar 28, 2003 Messages 332 Sorry.. I mean reading a date stamp from a file.. like when it was modified.. created, etc? Thanks je Upvote 0 Downvote
Sorry.. I mean reading a date stamp from a file.. like when it was modified.. created, etc? Thanks je
Aug 7, 2003 #4 pavNell Technical User Joined Sep 27, 2002 Messages 178 Location US oops, your subject header specified 'from a file'... #!/bin/sh ls -l | while read line do fileName=`echo $line | awk '{print $NF}'` fileDate=`echo $line | awk '{print $6}'` fileTime=`echo $line | awk '{print $7}'` echo "" echo "/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/" echo "File Name: $fileName" echo "File Date: $fileDate" echo "File Time: $fileTime" done That should get you started. HTH Upvote 0 Downvote
oops, your subject header specified 'from a file'... #!/bin/sh ls -l | while read line do fileName=`echo $line | awk '{print $NF}'` fileDate=`echo $line | awk '{print $6}'` fileTime=`echo $line | awk '{print $7}'` echo "" echo "/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/" echo "File Name: $fileName" echo "File Date: $fileDate" echo "File Time: $fileTime" done That should get you started. HTH