Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Tree command does not print properly Post 302945032 by bakunin on Monday 25th of May 2015 03:20:29 PM
Old 05-25-2015
Quote:
Originally Posted by stew
But when I run below command, tree structure getting
Code:
 
LC_ALL=C tree

what is permanent solution to print tree structure with "tree" command.
The set of language-specific characters in your environment is (maybe erronously) set so that the line-drawing characters are replaced by some other characters (which you called "junk"). Which set of characters is taking these places (german umlauts, french accents, ....) is controlled by the "LC_ALL" variable. To set this variable to "C" means to use a set of characters without any diacriticals at all, which is enough for english language but probably no other.

When you enter a certain setting for a variable and then a command it means that the value for this variable is in effect only for this one command. This means:

Code:
# LC_ALL=C tree
# tree

The first of the two commands will have set LC_ALL to "C" and therefore work, the second one will produce junk again because "LC_ALL" is set to something else.

Solution: set the variable somewhere where it has a lasting effect. The best place is your shells startup file: "~/.kshrc" if you use ksh (Korn shell), "~/.bashrc" if you use bash (Bourne Again Shell).

Put in the respective file the following line:

Code:
LC_ALL=C ; export LC_ALL

and start a new shell.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to output the results of the AT command - properly!

Hi, I am new to UNIX and I am more used to simple commands like those in VMS. One of them is the ability to get the output from a job using the /out=<file> command in VMS. I want to submit a job (a set of unix commands) using the AT command but to get the output in a file like that used in... (4 Replies)
Discussion started by: SpanishPassion
4 Replies

2. UNIX for Dummies Questions & Answers

tree command

In DOS, to get the complete directory structure, we use 'TREE' command.. can anyone tell me what is the equivalent command in Unix I am using SunOS ABC 5.8 Generic_117350-18 sun4u sparc SUNW,Sun-Fire-V240 thanks.. (1 Reply)
Discussion started by: wip_vasikaran
1 Replies

3. Solaris

What command can display files in a tree?

Is there a command that displays a certain path of files in a tree just like the dos command 'tree'? (17 Replies)
Discussion started by: Bradj47
17 Replies

4. Programming

c++ code to print a tree using stl map

hi all, i need c++ code to print a binary or non binary tree using stl map.... please help me to find the same.......... (1 Reply)
Discussion started by: vidyaj
1 Replies

5. UNIX for Dummies Questions & Answers

Tree command

How can i install tree command in ubundu without root ? I have found some shell script which does the same job as tree but i would like to get all the options in tree command thanks (2 Replies)
Discussion started by: gvj
2 Replies

6. Shell Programming and Scripting

Likely charset issue with tree command?

Hi All I'm using a tree command in a script that for me outputs:- | - - DIRECTORYNAME However a different user is getting the following output:- aaa (actually with an umlat above them) DIRECTORYNAME I'm not sure where this could be coming from, any ideas anyone? (0 Replies)
Discussion started by: Bashingaway
0 Replies

7. Shell Programming and Scripting

[Solved] Tree as alias command

Hi, I have this command: ls -R | grep ":$" | sed -e 's/:$//' -e 's/*\//--/g' -e 's/^/ /' -e 's/-/|/' Works nicely to show the current file structure as a tree. I'd like to have it as an alias in '' but doesn't work just like that and I can't fix it with backslashes: alias tree='?' ... (4 Replies)
Discussion started by: borobudur
4 Replies

8. UNIX for Dummies Questions & Answers

Help on ps tree listing command - Linux/Solaris

Hi all, Can any guru please help on how I can tweak the following ps command so that it only shows the lines that I wanted. $ command ps -HAcl -F S -A f F S UID PID PPID CLS PRI ADDR SZ WCHAN RSS PSR STIME TTY TIME CMD 4 S root 1 0 TS 24 - 2592 ? ... (3 Replies)
Discussion started by: newbie_01
3 Replies

9. Shell Programming and Scripting

Date command is not working properly

Hi, in my script, i take the last month by a=$(date --date '1 month ago' +%Y%m) i expect that it give me in this month "March" as result 201402, but linux gave me 201403. IMPe@ABC123:> ~/date --date '1 month ago' +%Y%m 201403 i'm reasonably confused. Any idea? Thanks in advance, ... (2 Replies)
Discussion started by: IMPe
2 Replies

10. Shell Programming and Scripting

awk print not working properly

Hello friends, There is one requirment where I need to login into database environment and pull all schema names into a text file ... as of now below are the schemas available... $> describe keyspaces; system_schema system_auth system abc system_distributed system_traces Now from... (4 Replies)
Discussion started by: onenessboy
4 Replies
i18n_intro(5)							File Formats Manual						     i18n_intro(5)

NAME
i18n_intro, i18n, LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME - Introduction to internationalization (I18N) DESCRIPTION
Internationalization refers to the process of developing programs without prior knowledge of the language, cultural data, or character- encoding schemes that the programs are expected to handle. In other words, internationalization refers to the availability and use of interfaces that let programs modify their behavior at run time for operation in a specific language environment. The abbreviation I18N is often used to stand for internationalization as there are 18 characters between the beginning "I" and the ending "N" of that word. The I18N interfaces and utilities provided in Tru64 UNIX conform to Issue 4 of X/Open CAE specifications. A concept related to internationalization is localization (L10N), which refers to the process of establishing information within a computer system for each combination of native language, cultural data, and coded character set (codeset). A locale is a database that provides information for a unique combination of these three components. However, locales do not solve all of the problems that localization must address. Many native languages require additional support in the form of language-specific print filters, fonts, codeset converters, char- acter input methods, and other kinds of specialized software. For additional introductory information on topics related to internationalization, refer to the following reference pages: For more infor- mation on localization and locales For an introduction to codeset conversion For a summary of printer support for native languages Characters, Character Sets, and Codesets A character is a member of a set of elements used for the organization, control, or representation of data. A character set is a set of alphabetic or other characters used to construct the words and other elementary units of a native language or computer language. A character set only specifies the characters that are included in the set. ASCII, CNS 11643 and DTSCS are examples of character sets. A coded character set (codeset) is a set of unambiguous rules that support one or more character sets and establishes the one-to-one rela- tionship between each character and its bit representation. In other words, a codeset consists of the code points for characters in one or more character sets. For example, DEC Hanyu (dechanyu) is a codeset for Chinese and contains code points for characters in the ASCII, CNS 11643-1986 (plane 1 and plane 2), and DTSCS character sets. Language Announcement (Setting Locale) Language announcement is the mechanism by which language, cultural data, and codeset requirements are set either for the system as a whole or by individual users. An application can also set these requirements, although it is more common for an internationalized application to use the setting in effect for the user who runs the program. Refer to the System Administration manual for information about setting sys- temwide defaults for shells. Refer to setlocale(3) and Writing Software for the International Market for information on how applications query or set locale requirements at run time. Language announcement is performed by setting one or more reserved environment variables to the name of an installed locale. Each locale has associated with it collating sequences, character conversion tables, character classification tables, formats for different kinds of data, and message catalogs. If the same locale meets user requirements in all these categories, set only the LANG environment variable to the locale name. A locale name usually has the following format: language_territory.codeset[@modifier] The following Korn shell example sets LANG to a locale supporting the English language, United States cultural data, and ISO8859-1 codeset: $ LANG=en_US.ISO8859-1 The following C shell example sets LANG to a locale supporting the Traditional Chinese language, Hong Kong cultural data, and the DEC Hanyu codeset: % setenv LANG zh_HK.dechanyu Note that locale name formats can vary from vendor to vendor. Use the locale -a command to display the names of locales installed on your system. Refer to the l10n_intro(5) reference page for a list of the locales provided with the Tru64 UNIX product. An alternative way to set locale requirements for all locale categories is to set the LC_ALL environment variable. The difference between the LANG and LC_ALL variables is that LC_ALL is a high-precedence variable that overrides all other locale variables, including LANG. The LANG variable, on the other hand, is a low-precedence variable. When used by itself, the LANG variable implicitly sets all locale cate- gories to the specified locale just as LC_ALL does. However, the LANG variable can be used together with variables for specific locale cat- egories to create a multilocale environment. The category-specific locale variables and what they control follow: String collation Charac- ter classification Translations for messages and valid strings for "yes" and "no" responses The currency symbol and the format of monetary values The format of numeric values The format of date and time values A locale can support only one set of date and time formats; however, there can be several sets of date and time formats in use for a particular language and territory. See the l10n_intro(5) reference page for information about creating a site-specific version of a locale to support date and time formats different from those supported by an installed locale. Some locale names have one or more @modifier suffixes. A locale with the suffix @ucs4 is for use by applications that require internal process code to be in UCS-4 format. See Unicode(5) for more information about UCS-4. Other @modifier suffixes indicate locale variants that support alternative rules for collation in Asian languages. Use locales with these suffixes only when setting LC_COLLATE. For example, there are three different sets of collation rules (chuyin, radical, and stroke) that can be used with the locale supporting the Chinese language, Taiwanese cultural data, and the Taiwanese EUC codeset. If Korn shell users want to use this locale, they might make the follow- ing settings: $ LANG=zh_TW.eucTW $ LC_COLLATE=zh_TW.eucTW@stroke The preceding example implicitly sets all locale category variables to zh_TW.eucTW, except for the LC_COLLATE variable, which is set to zh_TW.eucTW@stroke. The following locale command displays the variable settings after these assignments: $ locale LANG=zh_TW.eucTW LC_COLLATE=zh_TW.eucTW@stroke LC_CTYPE="zh_TW.eucTW" LC_MONETARY="zh_TW.eucTW" LC_NUMERIC="zh_TW.eucTW" LC_TIME="zh_TW.eucTW" LC_MESSAGES="zh_TW.eucTW" LC_ALL= SEE ALSO
Commands: locale(1), setlocale(3) Others: i18n_printing(5), iconv_intro(5), l10n_intro(5), Unicode(5) Writing Software for the International Market System Administration i18n_intro(5)
All times are GMT -4. The time now is 11:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy