Sponsored Content
Top Forums Shell Programming and Scripting zsh, prompt, variable expansion, ANSI color sequences Post 302633407 by Chubler_XL on Wednesday 2nd of May 2012 12:16:20 AM
Old 05-02-2012
Do the print -P when assigning the variables then:

Code:
# RED=$(print -P '\e[38;5;196m')
# NORM=$(print -P '\e[0m')        
# PS1="%{$RED%}Testing$ %{$NORM%}"
Testing $ 

or
Code:
# RED='%{'$(print -P '\e[38;5;196m')'%}'
# NORM='%{'$(print -P '\e[0m')'%}'
# PS1="${RED}Testing$ ${NORM}"
Testing $ 


Last edited by Chubler_XL; 05-02-2012 at 01:23 AM..
This User Gave Thanks to Chubler_XL For This Post:
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to change prompt color when changing path

Hi all, Can you tell me how to change the prompt color (only the path part) when I chnange directory with "cd"? I use the sequence below in ".bashrc" (Solaris 8) to change my prompt colors and I'd like to modify it to change the path color when I cange directory. PSC() { echo -ne "\"; }... (0 Replies)
Discussion started by: majormark
0 Replies

2. Shell Programming and Scripting

tcsh/csh: set prompt in production to color red

Hi folks This is our prompt at the moment oracle@pinkipinki:/opt/oracle> grep 'set prompt' .cshrc set prompt = "$user@`uname -n`:$cwd> " We wish to have in production the same prompt, but red. Howto do that? I tried a lot a internet manuals, but it doesn't work. (1 Reply)
Discussion started by: slashdotweenie
1 Replies

3. Programming

why the implementatoin of Bakery algorithm in ANSI C does not work in ANSI C

I follow the description of wiki (Lamport's bakery algorithm - Wikipedia, the free encyclopedia), then implement that algorithm in C, but it doesn't work, Starving is still here, is the implementation worry? Only print out: Thread ID: 0 START! Thread ID: 0 END! Thread ID: 0 START!... (2 Replies)
Discussion started by: sehang
2 Replies

4. Shell Programming and Scripting

how to find the value of a variable in zsh?

I have a zsh script written by someone else, I am trying to modify it to work on slightly different data -problem is I know nothing about shell scripting. I am trying to muddle through this myself since I need to learn but can someone tell me how to debug a script? ie. I want to display the value... (6 Replies)
Discussion started by: cmp260
6 Replies

5. Programming

Does ansi c support variable-length array?

I successfully compiled code like below. #include<stdio.h> #include<string.h> int main() { int co = 9; char a; strcpy(a, "hahahah"); printf("co=%d\n", co); printf("a=%s\n", a); return 0; } (7 Replies)
Discussion started by: vistastar
7 Replies

6. Programming

Using ANSI color codes in gcc compiled program

I have put some yellow color codes and works well. I call the funstion using print_usage(stderr, 0); I would like to know if there is any way, to store the ansi color codes in variables and then call them inside fprintf. Or have a format followed by the strings I want to output. ... (5 Replies)
Discussion started by: kristinu
5 Replies

7. Shell Programming and Scripting

Color prompt with file numbers does not work anymore

I have used this color prompt on my servers for long time, in file ~\.bashrc Black="\" Dark="\" Blue="\" LBlue="\" Green="\" LGreen="\" Cyan="\" LCyan="\" Red="\" LRed="\" Purple="\" LPurple="\" Brown="\" Yellow="\" LGray="\" White="\" Reset="\" PS1="$Yellow\u@\h $LBlue\w... (4 Replies)
Discussion started by: Jotne
4 Replies
MATHOMATIC(1)						      General Commands Manual						     MATHOMATIC(1)

NAME
mathomatic - a computer algebra system SYNOPSIS
mathomatic [ -bcehqrtuvwx ] [ -s level ] [ -m number ] [ input_files or input ] DESCRIPTION
Mathomatic is a general-purpose computer algebra system (CAS) that can symbolically solve, simplify, combine, and compare algebraic equa- tions, perform standard, complex number, modular, and polynomial arithmetic, etc. It does some calculus and handles all elementary alge- bra, except logarithms. Trigonometry and function expansion are supported in a separate program called rmath(1). Plotting expressions with gnuplot is also supported. mathomatic is the main Mathomatic application that does interactive symbolic-numeric mathematics through a simple command-line interface. Readline support is usually compiled into this application, making it easy to edit input and recall previous input with the cursor keys. The numeric arithmetic is double precision floating point with about 14 decimal digits accuracy. Many results will be exact, because sym- bolic math is an exact math, and because multiple floating point numbers can be combined for a single mathematical value; for example: 2^(1/3), which is the cube root of 2 exactly. OPTIONS
-b Enable bold colors. Color mode will be turned on and colors will be brighter if this option is specified. Same as the "set bold color" command. -c Toggle color mode. This mode outputs ANSI terminal escape sequences to make each level of parentheses a different color, for easier reading. Requires a terminal emulator that supports ANSI color escape sequences. If the colors are too hard to see, use the -b option to increase the color brightness. -e Process mathematical expressions and Mathomatic commands instead of input files on the shell command line, and then quit. Unquoted space characters are the line separators on the Mathomatic input that follows this option. Works similar to entering it into the Mathomatic main prompt, except the autoselect option is turned off. Useful for quick command-line calculations. The startup mes- sages are not displayed with this option. Follow this option with "--" so that expressions can start with a minus sign (-). -h Display a brief help message listing all of these options and then exit. -m number Change the memory size of equation spaces. It is followed by a decimal, floating point number which is a multiplier of the default equation space size. This allows larger equation spaces so that manipulating extremely large expressions will succeed without get- ting the "Expression too large" error. Specifying a number higher than 100 may make Mathomatic unresponsive. -q Set quiet mode. The startup messages and prompts are not displayed. This is useful when piping or redirecting input into Math- omatic, because the input won't be displayed, so prompt output should be turned off. This option does the same thing as the "set no prompt" command. -r Disable readline input processing. Readline allows line input editing using the cursor keys, and outputs terminal control codes, all of which can be turned off with this option. -s level Set the enforced security level for the Mathomatic session. Level 0 is the default with no security. Level 1 disallows shelling out (forking). Level 2 disallows shelling out and writing files. Level 3 disallows shelling out and reading/writing files. Level 4 is the highest security level and is the same as compiling with the -DSECURE option. This run-time option was created for use on open public servers. -t Set test mode. Used when testing and comparing output. Bypasses loading startup (rc) file, turns off color mode and readline, sets wide output mode, ignores pause command, etc. -u Guarantee that standard output and standard error output are unbuffered. Also echoes all line input if not in quiet mode ( -q option ). Useful when piping. -v Display version number, compilation options used, expression array size, maximum possible memory usage, and security level, then exit. -w Set wide output mode for an unlimited width output device like the "set wide" command does. Sets infinite screen columns and rows so that 2D (two-dimensional) expression output will always succeed and not be downgraded to 1D output when it doesn't fit in the display area. Use when redirecting output or with a terminal emulator that doesn't wrap lines. This mode only affects 2D output. -x Enable HTML output mode (which is also valid XHTML). This makes Mathomatic output suitable for inclusion in a web page. Color and bold mode affect this mode, allowing HTML color output. Wide output mode is also set by this option, meaning expressions will always be displayed in 2D. GENERAL
After any options, text files may be specified on the shell command line that will be automatically read in with the read command, unless the -e option is specified. Mathomatic is best run from within a terminal emulator. It uses console line input and output for the user interface. First you type in your mathematical equations in standard algebraic notation, then you can solve them by typing in the variable name at the prompt, or per- form operations on them with simple English commands. Type "help" or "?" for the help command, "help examples" to get started. If the command name is longer than 4 letters, you only need to type in the first 4 letters. Most commands operate on the current equation by default. A command preceded by an exclamation point (such as "!ls") is taken to be a shell command and is passed unchanged to the shell (/bin/sh). "!" by itself invokes the default shell, which is specified in the SHELL environment variable. "!" is also the factorial operator. Complete documentation is available in HTML and PDF formats; see the local documentation directory or online at "http://math- omatic.org/math/doc/" for the latest Mathomatic documentation. ENVIRONMENT
EDITOR The EDITOR environment variable specifies which text editor to use for the edit command. FILES
~/.mathomaticrc Optional startup file containing Mathomatic set command options. It should be a text file with one set option per line. Do not include the word "set". For example, the line "no color" will make Mathomatic default to non-color mode, which is useful if you aren't using a standard ANSI terminal emulator. AUTHOR
Mathomatic has been written by George Gesslein II (gesslein@mathomatic.org), with help from the Internet community. REPORTING BUGS
The command to take the limit of an expression is partially functional and experimental. All else should work perfectly; if not, please report it as a bug to the author or on the Launchpad website: "https://launchpad.net/mathomatic". SEE ALSO
rmath(1), matho-primes(1), primorial(1), matho-mult(1), matho-sum(1), matho-pascal(1), matho-sumsq(1) MATHOMATIC(1)
All times are GMT -4. The time now is 10:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy