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!

ksh -> echo ${var:-n/a}

Status
Not open for further replies.

w5000

Technical User
Nov 24, 2010
223
0
0
PL

is it possible to get working it with variable instead of plane/written "n/a" ?

so,
v="n/a"

and then:

echo ${var:-[red]$v[/red]}

(but of course working one ;-) )
 
Hi

Do you have a version restriction too ? That works for me in MKsh :
Code:
[blue]master[/blue] # v="n/a"

[blue]master[/blue] # echo ${var:-$v}
n/a

[blue]master[/blue] # var=wtf

[blue]master[/blue] # echo ${var:-$v}
wtf


Feherke.
[link feherke.github.com/][/url]
 
hmmm....

it looks it works in the simplest way...


Code:
$ ddd=bbb
$ echo ${SVSA:-$ddd}
bbb
$ ddd=n/a
$ echo ${SVSA:-$ddd}
n/a
$ echo ${SVSA:-$ddd}
n/a


stange... ;-)
 

nice, even coloured....

Code:
$ r="\033[31m"
$ n="\033[00m"
$ echo ${SVSA:-$r$ddd$n}
[red]n/a[/red]
$
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top