- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- about shell
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
Discussions
Discussions
Forums
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
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
тАО01-04-2005 04:48 AM
тАО01-04-2005 04:48 AM
about shell
i have a lettel question
when i type :
*****************
x="any string"
echo $x
the response is
any string
*****************
if i want to add spaces in variable as follow:
x=" any string"
echo $x
the response is the same
any string
******************
i want the response to be:
(spaces)any string
thank u
kamal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 04:56 AM
тАО01-04-2005 04:56 AM
Re: about shell
echo $x
man ascii and man echo for details.
\000 is octal representation of space
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 04:56 AM
тАО01-04-2005 04:56 AM
Re: about shell
Try,
x=" any string"
echo "$x"
Hope this helps.
Regds
- Tags:
- quoting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 05:13 AM
тАО01-04-2005 05:13 AM
Re: about shell
i tryed \000
and it works good
thankx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 07:02 AM
тАО01-04-2005 07:02 AM
Re: about shell
When you type:
x="^any string" (where "^" is a space...)
echo^$x
it expands into:
echo^^any string
Because any number of blanks is a legal seperator, you get "any string".
When you type:
x="^any string" (where "^" is a space...)
echo^"$x"
the space in "$x" is seperated from the word previous space, and will appear in the echo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 07:36 AM
тАО01-04-2005 07:36 AM
Re: about shell
$ typeset -R10 X=abc
$ echo $X
abc
$ echo "$X"
^^^^^^^abc
When dealing with strings in shells, you are caught between the shell's parsing features and maintaining the integrity of a string.
Bill Hassell, sysadmin