Ask Your Question
2

How do I insert spaces in the [+format] string of the date command

asked 2016-12-20 15:50:52 -0600

Andrei Costache gravatar image

Hello,

I am running Fedora Core 25, GNU Coreutils 8.25. I use one of the virtual consoles (Ctrl+Alt+F3).

When I run:

date +%a%b

I get:

TueDec

I would like to insert a space between Tue and Dec, therefore I run:

date +%a %b

However, instead of a space between Tue and Dec, I get:

date: extra operand %b

Can you guys help me out to get the space between Tue and Dec?

Many thanks, Andrei

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2016-12-20 16:55:47 -0600

Rabin gravatar image

updated 2016-12-21 04:22:58 -0600

use " (quotes) to aggregate parameters which include spaces

date "+%a %b"
edit flag offensive delete link more

Comments

This basic explanation of usage of quotes in terminal commands may be useful: http://www.howtogeek.com/howto/29980/...

florian gravatar imageflorian ( 2016-12-20 23:30:13 -0600 )edit

Here is the official documentation of the bash shell: http://www.gnu.org/software/bash/manu...

florian gravatar imageflorian ( 2016-12-20 23:31:41 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-12-20 15:50:52 -0600

Seen: 291 times

Last updated: Dec 21 '16