Re: Working! - Re: user crontab

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10May2020 13:36, Robert Moskowitz <rgm@xxxxxxxxxxxxxxx> 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 <cs@xxxxxxxxxx>
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux