LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   difference in GUI & CLI in command execution (http://www.linuxquestions.org/questions/linux-newbie-8/difference-in-gui-and-cli-in-command-execution-728608/)

gr8linux 05-26-2009 10:19 AM

difference in GUI & CLI in command execution
 
some commands give different output in graphical terminal and command line, why they do so?

e.g. $ echo -e "\033[5m"

will set blinking text in CLI mode but it wont work in Xterm........ why???

there are many commands with this problem.

i92guboj 05-26-2009 10:34 AM

Those are ANSI escape sequences or VT control codes that will only work (or fail) depending on the capabilities of the current terminal emulator that you are using. First thing to note is that xterm can emulate a number of different output devices (man page). Second thing is that you might already be using a coloured prompt or something like that, which might also contain its own escape codes that can override the one you supply in command line just 1 nanosecond after you press enter.

gr8linux 05-27-2009 12:10 AM

[QUOTE=i92guboj;3553270]Those are ANSI escape sequences or VT control codes that will only work (or fail) depending on the capabilities of the current terminal emulator that you are using. First thing to note is that xterm can emulate a number of different output devices (man page). Second thing is that you might already be using a coloured prompt or something like that, which might also contain its own escape codes that can override the one you supply in command line just 1 nanosecond after you press enter.[/QUO


thanx for ur answer, but i m not using a coloured prompt or something else.

when i typed

$ echo -e "\033[1m"

it will bold the text in Xterm but not in CLI...........


so, why it happens that some commands gives output onnly on CLI and some only on Xterm?????

chrism01 05-27-2009 01:25 AM

xterm is running on top of Xwindows (run level 5); CLI (assuming you mean run level 3) isn't.

gr8linux 05-27-2009 01:36 AM

Quote:

Originally Posted by chrism01 (Post 3553980)
xterm is running on top of Xwindows (run level 5); CLI (assuming you mean run level 3) isn't.


yes, but both are using same shell then how differences creates?

i92guboj 05-27-2009 09:58 AM

As said, this control codes are not interpreted by the shell, so, the fact that the shell is the same is completely irrelevant. They are intercepted by the terminal emulator, whatever that is. The effect of these control codes will only depend on the capabilities of your terminal emulator.

To check if a given capability is on you can use many methods, the first way to check is the $TERM variable. In what you call CLI it will be "linux", in an xterm is will be "xterm". Then you can act consequently on depending on what terminal emulator is being used.

gr8linux 05-28-2009 12:06 AM

Quote:

Originally Posted by i92guboj (Post 3554436)
As said, this control codes are not interpreted by the shell, so, the fact that the shell is the same is completely irrelevant. They are intercepted by the terminal emulator, whatever that is. The effect of these control codes will only depend on the capabilities of your terminal emulator.

To check if a given capability is on you can use many methods, the first way to check is the $TERM variable. In what you call CLI it will be "linux", in an xterm is will be "xterm". Then you can act consequently on depending on what terminal emulator is being used.



thankyou vry much.


All times are GMT -5. The time now is 08:45 PM.