Q:

How get ASCII characters similar to output of the linux command 'tree'?

Is there a way to print the ASCII charachter '├── ' and '└──' using a bash or perl script?
I want it be exactly like the output of 'tree'.
[root@localhost www]# tree -L 1
.
├── cgi-bin
├── error
├── html
└── icons

A:

They look to be a part of the extended ascii codes. You can see them here http://www.asciitable.com/
Also available at the Unicode table here: http://unicode-table.com/en/sections/box-drawing/

I believe 192, 195 and 196 are the ones you are after.
In Unicode 2501, 2514 and 2523.
EDIT
Found a related stack question here, which recommends printing in Unicode.

What you want is to be able to print unicode, and the answer is in perldoc perluniintro.
  You can use \x{nnnn} where n is the hex identifier, or you can do \N{...} with the name:

perl -E 'say "\x{2514}"; use charnames; say "\N{BOX DRAWINGS LIGHT UP AND RIGHT}"'

A:

echo -e "\0342\0224\0224\0342\0224\0200\0342\0224\0200 \033[01"

