LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-08-2006, 04:08 AM   #1
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Rep: Reputation: 20
date problem


hi there!!

i know this is just a simple issue but i need some help on to make this command(date '+%b%e') produce an output as an example below:

Jun 8 instead of Jun 8

(see the spaces..)

thank you all!!

Last edited by yongitz; 06-08-2006 at 04:55 AM.
 
Old 06-08-2006, 04:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
what spaces??
 
Old 06-08-2006, 04:33 AM   #3
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Original Poster
Rep: Reputation: 20
oh sorry! how do i display the extra spaces here? i mean the command date '+%b%e' would display Jun(space)8 or as in Jun 8.. but what i want to come up with is that I want it to display like Jun(space)(space)8 or 2 spaces between Jun and 8..
 
Old 06-08-2006, 04:39 AM   #4
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
what about
Code:
date '+%b %e'

regards,
slackie1000
 
Old 06-08-2006, 04:43 AM   #5
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by slackie1000
hi there,
what about
Code:
date '+%b %e'

regards,
slackie1000
hehe!! nice try! but ive done that already.. nothing happens..
 
Old 06-08-2006, 04:50 AM   #6
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Original Poster
Rep: Reputation: 20
sorry folks.. i forgot to tell you that im using this piece of command in a script... say:

#!/bin/sh
date=$(date '+%b%e')
echo $date
etc.. etc.. etc...


i want the space to appear in the output as in Jun(space)(space)8 instead of Jun(space)8 or Jun 8. how do i do that?

Last edited by yongitz; 06-08-2006 at 05:02 AM.
 
Old 06-08-2006, 04:58 AM   #7
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
you should have told us in your first post about the script.
Code:
echo "`date '+%b %e'`"
regards,
slackie1000
 
Old 06-08-2006, 05:09 AM   #8
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Original Poster
Rep: Reputation: 20
thank you but how do i do declare my date variable to come up with my desired output???
 
Old 06-08-2006, 06:39 AM   #9
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Put the variable in quotes...
Code:
#!/bin/sh

date=$(date '+%b  %e')
echo "$date"
 
Old 06-08-2006, 09:00 PM   #10
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by homey
Put the variable in quotes...
Code:
#!/bin/sh

date=$(date '+%b  %e')
echo "$date"

already done this but still the result is still the same...
 
Old 06-08-2006, 09:09 PM   #11
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
debian ~ # date=$(date '+%b%e')
debian ~ # echo "$date"
Jun 9
debian ~ #
 
Old 06-08-2006, 09:14 PM   #12
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by //////
debian ~ # date=$(date '+%b%e')
debian ~ # echo "$date"
Jun 9
debian ~ #
but i want it to display this way:

Jun(space)(space)9 instead of that output "Jun(space)9" or "Jun 9"
 
Old 06-08-2006, 09:34 PM   #13
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Original Poster
Rep: Reputation: 20
got it right!! i missed the double quotes.. thank you all!!!
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
date and clock problem matrixon Linux - Software 1 02-12-2006 11:09 PM
time date problem matrixon Linux - Software 1 01-13-2006 02:57 PM
Interesting problem with date zulfilee Linux - Software 2 06-25-2004 11:41 PM
lastlog date does not match system date? jcmj Linux - Networking 6 10-22-2002 12:09 PM
Date Problem webboss Linux - General 0 04-18-2001 05:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration