Date command + cut

Solved
Anonyme -  
 Anonyme -
Hello, I'm a complete beginner in Linux, and I would like to extract just the day from the date command...

Here is the code I tried to test but got no result. Just for your information, I'm on Ubuntu...

#!/bin/bash

CURRENTDATE=`cut -c1 date`

echo $CURRENTDATE

Thank you very much for your help...
Configuration: Linux Firefox 2.0.0.12

2 réponses

PeJo Posted messages 1384 Status Membre 176
 
Hello,

Try with the command: date | cut -c 1-3 (adjusting the 1-3 according to the output of the date command).

You can also do it with the command: date | awk -F" " '{print $1}' (adjusting 1 according to the output of date).

Have a nice day.

--
There are 3 types of people in the world. Those who know how to count and those who don’t.
And if you need nothing, just call me!!
0
Anonyme
 
Thank you very much, it's working well.
0