Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set a variable to one space

Status
Not open for further replies.

alhassani54

Programmer
Aug 1, 2002
27
0
0
GB
I would like to set a variable to one space.
If I do a=" " a will be null but I want a=one space.

Any help will be appreciated.

Thanks
 
Use single quotes...
[tt]
$ SPACE=' '
$ print "|${SPACE}|"
| |
$
[/tt]
Actually, the double quotes should work too.
 
What shell are you using? I just tried this with ksh93 and it worked out fine:

# X=" " # Just add an actual space inbetween the quotes.
# echo "$X HELLO"
HELLO
# echo " HELLO"
HELLO
# echo "HELLO"
HELLO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top