I put this is .bashrc
# colors
NC="$(tput sgr0)"
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
# etc ...
PS1="\[$BROWN\]\u \[$CYAN\]#\# \[$PINK_BLD\]!\!\[$NC\] \[$BLUE\]\W: \[$NC\]"
So
deepo #50 !545 ~: echo "This is an example what it will look like."
What is, and how do I use, the hash 50 indication?
There are many pages on how to do the PS1 (e.g., http://www.cyberciti.biz/tips/howto-lin
I've never really thought about how the shell actually executes piped commands. I've always been told that the "stdout of one program gets piped into the stdin of another," as a way of thinking about pipes. So naturally, I thought that in the case of say, A | B, A would run first, then B gets the stdout of A, and uses the stdout of A as its input.
Apart from the standalone exec >&2 to redirect the current shell's input and output are there any behavioral differences in the following commands:
echo -en "C\nB\nA\n" | sort 2>/dev/stdout >&2
echo -en "C\nB\nA\n" 2>/dev/stdout >&2 | sort
2>/dev/stdout >&2 echo -en "C\nB\nA\n" | sort
If the above commands were equivalent which is the preferred variant?
When I use
sed -i "s,.*%.*,$(tput setaf 1)&$(tput sgr0),g" A.log
the whole line vanishes and when I use
sed -i "s,^%.*,$(tput setaf 1)&$(tput sgr0),g" A.log
only the first character(%) turns red.
What should I do?
EDIT : Actually the whole line doesn't vanish, I was using more but when I used less -R
I saw this (with a control M character) and % in red color.
% Invalid input de
I have a general question about how the terminal and processes work.
From any process, if I write to stdout (i.e. file descriptor 2), it gets drawn on the terminal window. My question is, how is this actually implemented? Is stdout an actual 'dummy' file somewhere that the terminal keeps on reading from and drawing the content on screen?
I came across and unexpected behavior with redirections in tcsh.
----------- Summary -----------
I need a command/set of commands that can help me simulate a shell terminal via a PHP web page using commandline functions. How can I combine the power of nohup and a while loop to:
start the shell,
execute commands and print output (and errors i.e.
Is there a way in Windows 7 cmd shell to redirect the stderr to stdout while keeping the stderr stream intact?
For example, I have a program that outputs to stderr and stdout the following message
TO STDOUT
TO STDERR
I want to have two files stderr.txt and stdout.txt with the following content
stderr.txt
TO STDERR
stdout.txt
TO STDOUT
TO STDERR
Is this possible?
I would like to configure the terminal type by detecting it. For example when I am connecting to a Solaris box with PuTTY, the $TERM variable is set to vt100. I would like to negotiate this and when the terminal emulator is PuTTY to set $TERM to xterm.
I've noticed that at ^E PuTTY answers back with PuTTY.