Sunday, September 23, 2007

How to print a line of dashes in UNIX using the print command in ksh?

Normally when you try to print a line of dashes or any text starting with a dash e.g -3 using the 'print' command in an Unix korn shell script it will not print anything

$> print "--------------------------"

$>

To overcome this you can either use the -R option which will make print ignore all following options and escapes.

$> print -R "--------------------------"
--------------------------
$>

or use the print command with the double dash option print -- this tells the print command where -- stated that no more options follow.

$> print -- "--------------------------"
--------------------------
$>

2 comments:

Anonymous said...

People should read this.

We_Feel said...

Glad it was of help. :)

A TRIP TO BHANDUP PUMPING STATION - the birdwatchers paradise

"A Picture from Bhandup Pumping Station" I am a nature lover, and I often like to go birdwatching with my dad. We had read that ...