On 10May2020 13:36, Robert Moskowitz <r...@htt-consult.com> wrote:
It is entirely true. The collapsing happens when you _use_ the values:

   # all safe and reliable
   $ a=$( date +'%a %b %d %T %Y')
   $ b=$( date +'%a  %b  %d  %T  Y')
   $ c=$b

   # unquoted use
   $ echo $a
   Sat May 09 14:37:07 2020
   $ echo $b
   Sat May 09 14:37:15 2020
   $ echo $c
   Sat May 09 14:37:15 2020

   # quoted use
   $ echo "$a"
   Sat May 09 14:37:07 2020
   $ echo "$b"
   Sat  May  09  14:37:15  2020
   $ echo "$c"
   Sat  May  09  14:37:15  2020

The variable $b contains the multiple spaces you put in your date format. But they only survive is you quote the variable when you use it. [...]

I am having problems taking out the '

You've misread things.

Keep the ' quote, it is needed so that the '+.....' argument remains _one_ argument to the date command.

We're talking about dropping the " from the "$(...)" part. So change:

 currentDate="$(date +'%a %b %d %T %Y')"

into:

 currentDate=$(date +'%a %b %d %T %Y')"

which does not need the double quotes because the shell parses currentDate=$(......) as the assignment because of the punctuation.

Cheers,
Cameron Simpson <c...@cskk.id.au>
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to