The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > Linux > SuSE
.
google unix.com



SuSE SUSE Linux is a major operating system. The developer rights are owned by Novell, Inc.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
running command "top" in cron freddy1228 UNIX for Dummies Questions & Answers 3 03-18-2008 04:43 PM
How to display hostname in command prompt civic2005 SUN Solaris 3 10-12-2007 10:42 AM
Inconsistent memory usage display spdas Filesystems, Disks and Memory 2 02-16-2007 01:15 AM
PS command does not display shell script running hadarot Shell Programming and Scripting 4 09-15-2005 06:56 AM
Running "wall" command from cron xadamz23 Shell Programming and Scripting 1 05-27-2005 09:43 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-30-2007
rajranibl rajranibl is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 5
inconsistent ls command display at the command prompt & running as a cron job

Sir,
I using the following commands in a file (part of a bigger script):
#!/bin/bash
cd /opt/oracle/bin
ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out

If I run this from the command prompt the result is:

2007-05-16

if I run it as a cron job then I get:

May

In both cases I need to get:

2007-05-16
Can any help with this?


Thanks in advance.
  #2 (permalink)  
Old 07-30-2007
quintet quintet is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 94
Which OS you are using. I tried the same command in AIX

ls -lt | tail -1 | awk '{print $6}'

and I got 'Jul' as response
  #3 (permalink)  
Old 07-30-2007
rajranibl rajranibl is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 5
We are using suse enterprize 9
Linux 2.6.5-7.283-smp #1 SMP Wed Nov 29 16:55:53 UTC 2006 x86_64 x86_64 x86_64 GNU/Linu
  #4 (permalink)  
Old 07-30-2007
quintet quintet is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 94
I am not sure..

try executing the command with full path


/bin/ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out
  #5 (permalink)  
Old 07-30-2007
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
/bin/ls -lt --time-style=locale | ...

Cheers,
ZB
  #6 (permalink)  
Old 07-30-2007
rajranibl rajranibl is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 5
Thanks for all the suggestions and a solution.

time-style= long-iso or time-style=+%Y-%m-%d will do us nicely.

Once again thanks.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:43 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0