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
XtLanguageProc()														  XtLanguageProc()

Name
  XtLanguageProc - interface definition for a procedure to set the locale and return the language string.

Synopsis
  typedef String (*XtLanguageProc)(Display*, String, XtPointer);
	   Display *display;
	   String language;
	   XtPointer client_data;

Inputs
  display   Specifies the connection to the X server.

  language  Specifies  the  initial  language  string  obtained from the command line or server per-display resources, or NULL if no language
	    specification is found.

  client_data
	    Specifies data registered with this function in the call to XtSetLanguageProc().

Returns
  The language string for the display.

Availability
  Release 5 and later.

Description
  An XtLanguageProc and its client_data argument are registered with a call to XtSetLanguageProc().  It is invoked  by	XtDisplayInitialize()
  with the initial value of the language string or NULL.

  A language procedure is passed the language string, if any, from the application command line or per-display resources, and should use that
  string to localize the application appropriately.  Setting the locale usually involves calling setlocale(), XSupportsLocale(), and  XSetLo-
  caleModifiers(),  but applications that use other localization schemes may need to do different or additional initialization in this proce-
  dure.

  An XtLanguageProc returns a string which will be set as the language string of the display by XtDisplayInitialize(), and will  be  used  in
  future calls to XtResolvePathname() to find localized files.	The returned string may be different than the language argument.  If language
  is NULL, for example, a language procedure might determine the locale from an environment variable and return that value.  If the  language
  procedure  calls  setlocale(), then the return value of this function is an appropriate return value for the function.  The Intrinsics will
  make a private copy of this string.

Usage
  All internationalized programs should call XtSetLanguageProc() before calling XtAppInitialize(), but most can simply use the	default  lan-
  guage  procedure  (pass  NULL for the proc argument).  The default procedure should be sufficient for all applications that use only ANSI-C
  and X-based internationalization schemes.

Example
  The following is the Intrinsics default language procedure:

     /*ARGSUSED*/
     static String _XtDefaultLanguageProc(dpy, xnl, closure)
	 Display   *dpy;     /* unused */
	 String     xnl;
	 XtPointer  closure; /* unused */
     {
	 if (! setlocale(LC_ALL, xnl))
	     XtWarning("locale not supported by C library, locale unchanged");

	 if (! XSupportsLocale()) {
	     XtWarning("locale not supported by Xlib, locale set to C");
	     setlocale(LC_ALL, "C");
	 }
	 if (! XSetLocaleModifiers(""))
	     XtWarning("X locale modifiers not supported, using default");

	 return setlocale(LC_ALL, NULL); /* re-query in case overwritten */
     }

See Also
  XtDisplayInitialize(1), XtSetLanguageProc(1).

Xt - Locale Management														  XtLanguageProc()
All times are GMT -4. The time now is 07:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy