01-06-2015
That's because the second time you (recursively) call function one, the else branch of if [ "$name" == "Sam" ]; will be taken.
BTW, you have a 16 bit char (0x 3000000, UTF8: 0xE3 0x80 0x80) in two seemingly empty lines that cause "command not found" errors in my bash shell.
Last edited by RudiC; 01-06-2015 at 06:34 AM..
These 2 Users Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am writting a script in csh and I am blanking out on how I code in the ability to process user input in the middle of a while/end loop.
while(1)
args..
end
it is a simple script, and I want to add hotkey functions, like q to quit, z to zero counters, etc..
Google has not been very... (1 Reply)
Discussion started by: seg
1 Replies
2. Shell Programming and Scripting
Hi all
Does anyone have a script that will allow me to stop inside a while read loop.
I want to pause the loop until a enter is pressed.
e.g.
While read line
do
echo something
if LINECOUNT > 40
then
read ENTER?"PRESS ENTER TO CONT..."
... (3 Replies)
Discussion started by: jhansrod
3 Replies
3. Shell Programming and Scripting
here's my code:
ls -lt | /usr/bin/egrep `date +"%Y%m%d(05|06|07|08|09|10|11|12|13|14|15|16|17|18|19)"` | \
/usr/bin/egrep -i .dat | /usr/bin/awk '{print $9}' > $LockboxFile1
if ]
then ... (2 Replies)
Discussion started by: sytycd712
2 Replies
4. Shell Programming and Scripting
Hello,
I need help with a bash script that I try to improve. I could not find answer so far, maybe because I'm not to familiar with the terminology so feel free to correct my language.
I have a script that looks like:
NODES="node_a node_b node_c"
for NODE in $NODES
do
... (4 Replies)
Discussion started by: pn8830
4 Replies
5. Shell Programming and Scripting
Test - Test (1 Reply)
Discussion started by: Amit Sura
1 Replies
6. Shell Programming and Scripting
Hi Guys,
I have file A.txt
PP97
PP66
PP87
PP66
PP47
PP57
PP44
PP20
PP66
PP16
PP13
PP51
PP68
PP70
PP75
PP30 (2 Replies)
Discussion started by: asavaliya
2 Replies
7. Shell Programming and Scripting
I have a shell script, and its pretty much done, I decided to add a loop that ends or continues depending on user input. like "would you like to continue?" and if I hit y or yes it will run the loop again until I hit n or no and breaks out of the loop.
To be hones I didn't think I needed to add... (2 Replies)
Discussion started by: Demon_Jester
2 Replies
8. UNIX for Dummies Questions & Answers
Hello nix Experts,
I am a *nix rookie and have run into this issue, can some one help me here and let me know what I am doing wrong.
/home/user1> while read n
> do
> echo $n
> done < <(find . -type f -ctime -1 | grep abc)
I am getting the below error:
-sh: syntax error near... (5 Replies)
Discussion started by: babyPen1985
5 Replies
9. Shell Programming and Scripting
I have the following while loop that I put in a script, demo.sh:
while read rna; do
aawork=$(echo "${rna}" | sed -n -e 's/\(...\)\1 /gp' | sed -f rna.sed)
echo "$aawork" | sed 's/ //g'
echo "$aawork" | tr ' ' '\012' | sort | sed '/^$/d' | uniq -c | sed 's/*\(*\) \(.*\)/\2: \... (3 Replies)
Discussion started by: faizlo
3 Replies
10. Shell Programming and Scripting
When I create a newfile, I am using the filename as a variable to create the new filename. When I ouput it, the filename contains the file extension in the middle of the file
example:
router1.txtshcdpneighbors.txt
router2.logshcdpneighbors.txt
My initial approach was to strip it out, now I... (2 Replies)
Discussion started by: dis0wned
2 Replies
NL2BR(3) 1 NL2BR(3)
nl2br - Inserts HTML line breaks before all newlines in a string
SYNOPSIS
string nl2br (string $string, [bool $is_xhtml = true])
DESCRIPTION
Returns $string with '<br />' or '<br>' inserted before all newlines (
,
,
and
).
PARAMETERS
o $string
- The input string.
o $is_xhtml
- Whether to use XHTML compatible line breaks or not.
RETURN VALUES
Returns the altered string.
EXAMPLES
Example #1
Using nl2br(3)
<?php
echo nl2br("foo isn't
bar");
?>
The above example will output:
foo isn't<br />
bar
Example #2
Generating valid HTML markup using the $is_xhtml parameter
<?php
echo nl2br("Welcome
This is my HTML document", false);
?>
The above example will output:
Welcome<br>
This is my HTML document
Example #3
Various newline separators
<?php
$string = "This
is
a
string
";
echo nl2br($string);
?>
The above example will output:
This<br />
is<br />
a<br />
string<br />
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | Added the optional $is_xhtml parameter. Before |
| | this version '<br />' was always inserted. |
| | |
+--------+---------------------------------------------------+
SEE ALSO
htmlspecialchars(3), htmlentities(3), wordwrap(3), str_replace(3).
PHP Documentation Group NL2BR(3)