- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- echo Whitespace stripping....
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 05:44 AM
06-06-2002 05:44 AM
^^^^^^^
date +%b" "%e" "%I:%M:
and you get something like:
Jun 6 08:38:
(depending on what day and time you execute it)
Now execute:
^^^^^^^^^^^^
echo `date +%b" "%e" "%I:%M:`
or
echo $(date +%b" "%e" "%I:%M:)
and you get:
Jun 6 08:38:
Did you notice the difference in the output? Look again, side by side:
************************
Jun 6 08:38:
Jun 6 08:38
************************
Why is my whitespace infront of the day being stripped away when echo (or print) prints the output of the date command!!?
rab
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 05:53 AM
06-06-2002 05:53 AM
Solutionecho drops multiple whitespaces.
echo `date +%b" "%e" "%I:%M:`
results in :
echo Jun##6#03:46:
(replace blanks by # for visibility)
which outputs:
Jun#6#03:46:
If you want to preserve the blanks you should add quotes:
echo "`date +%b' '%e' '%I:%M:`"
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 05:57 AM
06-06-2002 05:57 AM
Re: echo Whitespace stripping....
It's not really echo that drops the duplicate blanks, but rather the shell.
echo uses arguments like any other program, so to preserve blanks in the arguments, add quotes.
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 05:58 AM
06-06-2002 05:58 AM
Re: echo Whitespace stripping....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 06:27 AM
06-06-2002 06:27 AM
Re: echo Whitespace stripping....
;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 11:23 AM
06-06-2002 11:23 AM
Re: echo Whitespace stripping....
Marty