06-03-2013
If i remove the backticks i am seeing all the text or lines (if statements....etc) from there and after that turned into red color, i thought color changed because my syntax in the script was wrong? do you know why this behaviour?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Can somebody please guide me towards right syntax:
#!/bin/ksh
if i = $(grep $NAME filename)
echo "Name Found"
else
echo " Name not Found"
fi
I need to grep for $NAME in the file, and if it returns false, execute a series of commands and if true, exit out.
The above is not the right... (3 Replies)
Discussion started by: chiru_h
3 Replies
2. Shell Programming and Scripting
Okay, well this is more or less my first attempt at writing a shell script.
Anyways, here's my code:
cd ${PATH}
if
then
rm ${FILE}
./anotherScript
else
exit 1
fi
exit 1
Anyways, it's a pretty simple script that is supposed to search for the... (4 Replies)
Discussion started by: cbo0485
4 Replies
3. Shell Programming and Scripting
I'm piping the results of a tcpdump into a shell script and want certain commands executed (specifically the firing of an SNMP alert) based on a grep for certain contents in the output of tcpdump.
For example, I have
#!/bin/bash
while read str; do
grep 'ttl 64' -q && sudo snmptrap -v 1... (2 Replies)
Discussion started by: paulobrad
2 Replies
4. UNIX for Dummies Questions & Answers
(extract from SQL binlog file...)
# at 4960
#080801 14:35:31 server id 4 end_log_pos 195 Query thread_id=63121426 exec_time=0 error_code=0
use d_jds;
SET TIMESTAMP=1217581531;
UPDATE bid_details set bidding = 3170.37 ,deduction=if((3170.37 < 37.43),0,deduction)
where... (3 Replies)
Discussion started by: shantanuo
3 Replies
5. Shell Programming and Scripting
Hi All,
Please can somebody advise that if I want to search a pattern xyz the grep command should only select xyz and not any other pattern containing xyz (ex abxyzcd)
Regards (1 Reply)
Discussion started by: Shazin
1 Replies
6. Shell Programming and Scripting
I'm searching the most effective way of doing the following task, so if someone can either provide a working solution with sed or one totally different but more effective then what I've got so far then please go ahead!
The debugme directory has 3 subdirectorys and each of them has one .txt file... (7 Replies)
Discussion started by: TehOne
7 Replies
7. Shell Programming and Scripting
Please see the script segment below
for i in $files
do
echo $i
if ; then
case "$1" in
"IE0263"|"IE0264"|"IE0267"|"IE0268")
short_filename=`ls -l $i | cut -c108-136 | sort`
;;
"IE0272"|"IE0273")
short_filename=`ls -l $i | cut... (4 Replies)
Discussion started by: jmahal
4 Replies
8. Shell Programming and Scripting
Hi,
I have an array with characters and I am looking for specific character in that array and if those specific character not found than I use goto statment which is define somehwhere in the script. My code is:
set a = (A B C D E F)
@ i = 0
while ($i <= ${#a})
if ($a != "F" || $a != "D")... (3 Replies)
Discussion started by: dixits
3 Replies
9. UNIX for Dummies Questions & Answers
I receive a segmentation fault on some servers when grepping a string, but not when I use -i, and vice-versa. I have googled this and realise it is usually a hardware / memory issue.
I'd like to write an if statement that says "if grep string returns 'Segmentation fault' then grep the same... (4 Replies)
Discussion started by: MaindotC
4 Replies
10. Shell Programming and Scripting
Hi,
Am working in a filenet domain where we are using AIX as our terminal to run the jobs and schedule the shell scripts to run . In my previous post regarding the "Log modification with finding errors" ... (12 Replies)
Discussion started by: Kalaihari
12 Replies
LEARN ABOUT PHP
ncurses_init_pair
NCURSES_INIT_PAIR(3) 1 NCURSES_INIT_PAIR(3)
ncurses_init_pair - Define a color pair
SYNOPSIS
int ncurses_init_pair (int $pair, int $fg, int $bg)
DESCRIPTION
Defines or redefines the given color pair to have the given foreground and background colors. If the color pair was previously initial-
ized, the screen is refreshed and all occurrences of it are changed to reflect the new definition.
Color capabilities must be initialized using ncurses_start_color(3) before calling this function. The first color pair (color pair 0) is
assumed to be white on black by default, but can be changed using ncurses_assume_default_colors(3).
PARAMETERS
o $pair
- The number of the color pair to define.
o $fg
- The foreground color for the color pair. May be one of the pre-defined colors or one defined by ncurses_init_color(3) if the
terminal has color changing capabilities.
o $bg
- The background color for the color pair. May be one of the pre-defined colors or one defined by ncurses_init_color(3) if the
terminal has color changing capabilities.
RETURN VALUES
Returns -1 if the function was successful, and 0 if ncurses or color support were not initialized.
NOTES
Note that color changing capabilities are not required for defining color pairs of pre-existing colors, but only for changing definitions
(red, green, and blue components) of colors themselves per ncurses_init_color(3).
EXAMPLES
Example #1
Writing a string with a specified color to the screen
<?php
ncurses_init();
// If the terminal supports colors, initialize and set active color
if (ncurses_has_colors()) {
ncurses_start_color();
ncurses_init_pair(1, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
ncurses_color_set(1);
}
// Write a string at specified location
ncurses_mvaddstr(10, 10, "Hello world! Yellow on blue text!");
// Flush output to screen
ncurses_refresh();
ncurses_end();
?>
SEE ALSO
ncurses_pair_content(3), ncurses_start_color(3).
PHP Documentation Group NCURSES_INIT_PAIR(3)