- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Scripting: howto preserve whitespace
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
07-04-2002 01:26 AM
07-04-2002 01:26 AM
I seem to be blockheaded.
I cannot recall how to preserve whitespace with variable assignments in command substitutions when shell scripting.
In Perl this is no issue at all.
Please have a look at the attachment to see what I mean.
Regards
Ralph
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 01:31 AM
07-04-2002 01:31 AM
Re: Scripting: howto preserve whitespace
use the IFS variable. Before you do cm=$(...
do; IFS=''
Then it echoes fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 01:32 AM
07-04-2002 01:32 AM
Re: Scripting: howto preserve whitespace
cm="/abd/def/gh iii jjj"
echo $cm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 01:36 AM
07-04-2002 01:36 AM
Re: Scripting: howto preserve whitespace
I would do this instead:
# /usr/sbin/cmviewcl -v -p depot > /tmp/cm.txt
# cm=/tmp/cm.txt
# cat $cm
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 01:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 01:56 AM
07-04-2002 01:56 AM
Re: Scripting: howto preserve whitespace
echo $cm
but
echo "$cm"
(I have not tried it with cmviewcl, but just with a cat(1) of a file containing your posted cmviewcl output. To be on the safe side, I did and "unexpand -a" on the file, so it did not only contain spaces, but also tabs.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 01:57 AM
07-04-2002 01:57 AM
Re: Scripting: howto preserve whitespace
yeah, that was it
of course, I forgot $IFS
In Perl its equivilant is the package global $/
Loks I've forgotten all about shell scripting :-(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 02:01 AM
07-04-2002 02:01 AM
Re: Scripting: howto preserve whitespace
your solution is preferable, because it's safer than tampering with IFS
Argh, how could I forgot the shells quoting mechanics?
Steven,
I want to avoid the creation of temporary files.