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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank Space as a Variable 1

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332
Hello,
Could someone tell me how to pass a blank space as a variable?

 
Pass to who - and in what language?

Shell example - enclose the spaces in quotes
Code:
echo "hello          world"
 
Sorry.. in ksh, i'd like to pass a blank variable:

a=" "

to a function.

myfunction $a

Is this possible?

Thanks!
je
 
myfunction "$a"

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
okay... if this is passing it...
how can I padd something with blank spaces...

function &quot;$a&quot; 20
the 20 being the length of how many blank spaces I need...
The &quot;20&quot; will be dynamic.. As well as the $a, because at times I will use something other than the blank space...

Thanks..


 
#!/bin/ksh

v=&quot;1234&quot;
typeset -i padded=20

f1() # $1 - var ; $2 - padded
{
printf &quot;%${2}s&quot; &quot;${1}&quot;
}

f1 &quot;${v}&quot; &quot;${padded}&quot;


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top