Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 633647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:12:33+00:00 2026-05-13T20:12:33+00:00

Cygwin user here (though if there’s a suitable solution I will carry it over

  • 0

Cygwin user here (though if there’s a suitable solution I will carry it over to K/Ubuntu, which I also use).

I have a Welcome message in my .bashrc that looks like the following:

SAD=(`date +%A-%B-%d-%Y`)
DUB=(`date -u +%k:%M`)
printf "Today's Date is: ${SAD}.\n"
printf "Dublin time is now ${DUB}. (24-Hour Clock)\n"

After numerous attempts to use whitespaces in the variable SAD above, I gave in and used hyphens. But I am, understandably, not satisfied with this band-aid solution. The problem, as I recall, was that every time I tried using quoted space, \s or some similar escape tag, along with the variables listed in the appropriate section of the GNU manpage for date, the variable for Year was either ignored or returned an error. What I do’nt want to have to do is resort to the full string as returned by date, but rather to keep the order in which I have things in the code above.

As I write this, it occurs to me that setting the IFS around this code for the Welcome message may work, provided I return it to defaults afterwards (the above appears at lines 13-17 of a 68-line .bashrc). However, I can’t recall how to do that, nor am I sure that it would work.

Generally-speaking, .bashrc files are in valid BASH syntax, aren’t they? Mine certainly resemble the scripts I’ve either written myself or tested from other sources. All I’m missing, I suppose, is the code for setting and unsetting the field separators around this message block.

No doubt anyone who comes up with a solution will be doing a favor not only to me, but to any other relative newbies on the Net taking their first (or thirteenth through seventeenth) steps in the world of shell scripting.

BZT

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:12:33+00:00Added an answer on May 13, 2026 at 8:12 pm

    Putting

    SAD=$(date "+%A %B %d %Y")
    DUB=$(date -u +%k:%M)
    echo "Today's Date is: ${SAD}."
    echo "Dublin time is now ${DUB}. (24-Hour Clock)"
    

    in my .bash_profile prints

    Today's Date is: Thursday February 18 2010.
    Dublin time is now 12:55. (24-Hour Clock)
    

    I think that’s what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use cygwin sqlplus to connect to a remote oracle installation located
I run 'net use /user:Someone \somewhere', and it works well with cmd.exe. With the
I have windows box, also there is linux box where I have my account
Does cygwin allow a statically compiled binary? This would prevent the need for cygwin1.dll
My cygwin xterm is not responding to the keyboard. I am able to run
I've long used cygwin's nm command for all my .lib symbol debugging needs, but
I've tried msysGit and Git on Cygwin. Both work just fine in and of
Is it possible to compile and run OpenGL programs from under Cygwin? If yes,
I get the following error when trying to run the latest Cygwin version of
How can I execute a.exe using the Cygwin shell? I created a C file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.