Sponsored Content
Full Discussion: New line in Echo command
Top Forums UNIX for Dummies Questions & Answers New line in Echo command Post 302870071 by bakunin on Friday 1st of November 2013 04:40:59 AM
Old 11-01-2013
MadeInGermany is correct, but you probably want to know why:

If you check the HTML source code you produce you will see that indeed there are three lines as Scott said and suggested. HTML source code, though, is not displayed as it is when you display it using a web browser. The browser interprets it and part of this interpretation is to "interpret away" the line breaks.

MadeInGermany just put the HTML equivalent of line breaks (the "<br />" tags) into the text, which will - when interpreted by a web browser - produce line breaks. Notice, that your text will, when showed in a web browser, look the same if you write:

Code:
Var_name="This is first line.<br />
This is second line.<br />
This is third line."

or

Code:
Var_name="This is first line.<br />This is second line.<br />This is third line."

because the "away-interpretation" of real line breaks works both ways: the browser simply ignores them and it will also ignore their absence.

I hope this helps.

bakunin

/PS: remove the (real) line breaks from your variables content, the browser would ignore them anyway. Their existence is probably the reason why your sed-statement is failing: web browsers ignore line breaks, but sed does not.

Last edited by bakunin; 11-01-2013 at 05:49 AM..
This User Gave Thanks to bakunin For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to echo the file contents LINE BY LINE

hello, i have a listing (let say ABC) consists of the below: : public database link public synonym role rollback segment : when i run the below for loop, for i in `more ABC` do echo "$i" done it gives me, : public database (4 Replies)
Discussion started by: newbie168
4 Replies

2. Shell Programming and Scripting

Output of both the echo statement in one line

I have script like echo -n FINISHED FEXP: ${TABLE2EXP} echo $STATUS I want the output of both the echo statement in one line How can i do this (3 Replies)
Discussion started by: scorp_rahul23
3 Replies

3. UNIX for Advanced & Expert Users

echo and new line

hi I want to display: The students are: a b c What I get from echo "The students are:" "$list" is The students are: a b c any idea? (6 Replies)
Discussion started by: melanie_pfefer
6 Replies

4. Shell Programming and Scripting

new line in echo

Hi i would like disply the new line in echo command. i have input like: echo " X1 02:12:13 X2 03:02:12 " out put: X1 02:12:13 X2 03:02:12 can you tell how can use new line option in echo command. (5 Replies)
Discussion started by: koti_rama
5 Replies

5. Shell Programming and Scripting

Need a Command To display "echo command value in loop" in single line.

Hi I want to display "echo command value in loop" in single line. My requirement is to show the input file (test_1.txt) like the output file (test_2.txt) given below. Input file :test_1.txt a1|b1|4|5 a1|b1|42|9 a2|b2|32|25 a1|b1|2|5 a3|b3|4|8 a2|b2|14|6 Output file:test_2.txt... (2 Replies)
Discussion started by: sakthifire
2 Replies

6. Shell Programming and Scripting

Echo and a command's output on the same line

Hello, I'm writing some bash scripts and I'm trying to get an echo command and the output of another command to display on the same line. For example: I want to run echo "Operating System: " unameand have it displayed as Operating System: Darwin Thanks for your help! (7 Replies)
Discussion started by: codyhazelwood
7 Replies

7. Shell Programming and Scripting

echo two command output in the same line

Hi, I try to write script and echo two command at the same line . echo "A" echo "B" How can I pipe above two command at the same line in text file . So, in the output text file , you can see below ??? A B not A B Any sugggestion ??? (4 Replies)
Discussion started by: chuikingman
4 Replies

8. Shell Programming and Scripting

How to read in a part of an echo line?

Hello, I have a very basic script #!/usr/bin/ksh while print ' ' print ' 1. View Command History ' print ' 2. List files in current Directory ' read opt'?Enter Option> ' ;do if ;then fc -l fi # if ;then ls -la I want to... (10 Replies)
Discussion started by: Grueben
10 Replies

9. Shell Programming and Scripting

Need to echo command successful if command is executed successfully

Hello, I have written a command n shell script : srvctl relocate service -d t1 -s s1 -i i1 -t t1 -f If the above command executes successfully without error I need to echo "Service relocated successfully and If it errors out I need to trap the errors in a file and also need to make... (1 Reply)
Discussion started by: Vishal_dba
1 Replies

10. Shell Programming and Scripting

Echo printing a line in 2 lines; expected to print in one line

Dear All, fileName: therm.txt nc3h7o2h 7/27/98 thermc 3h 8o 2 0g 300.000 5000.000 1390.000 41 1.47017550e+01 1.71731699e-02-5.91205329e-06 9.21842570e-10-5.36438880e-14 2 -2.99988556e+04-4.93387892e+01 2.34710908e+00 4.34517484e-02-2.65357553e-05 3 ... (7 Replies)
Discussion started by: linuxUser_
7 Replies
GIT-WEB--BROWSE(1)						    Git Manual							GIT-WEB--BROWSE(1)

NAME
git-web--browse - git helper script to launch a web browser SYNOPSIS
git web--browse [OPTIONS] URL/FILE ... DESCRIPTION
This script tries, as much as possible, to display the URLs and FILEs that are passed as arguments, as HTML pages in new tabs on an already opened web browser. The following browsers (or commands) are currently supported: o firefox (this is the default under X Window when not using KDE) o iceweasel o konqueror (this is the default under KDE, see Note about konqueror below) o w3m (this is the default outside graphical environments) o links o lynx o dillo o open (this is the default under Mac OS X GUI) o start (this is the default under MinGW) Custom commands may also be specified. OPTIONS
-b BROWSER, --browser=BROWSER Use the specified BROWSER. It must be in the list of supported browsers. -t BROWSER, --tool=BROWSER Same as above. -c CONF.VAR, --config=CONF.VAR CONF.VAR is looked up in the git config files. If it's set, then its value specify the browser that should be used. CONFIGURATION VARIABLES
CONF.VAR (from -c option) and web.browser The web browser can be specified using a configuration variable passed with the -c (or --config) command line option, or the web.browser configuration variable if the former is not used. browser.<tool>.path You can explicitly provide a full path to your preferred browser by setting the configuration variable browser.<tool>.path. For example, you can configure the absolute path to firefox by setting browser.firefox.path. Otherwise, git web--browse assumes the tool is available in PATH. browser.<tool>.cmd When the browser, specified by options or configuration variables, is not among the supported ones, then the corresponding browser.<tool>.cmd configuration variable will be looked up. If this variable exists then git web--browse will treat the specified tool as a custom command and will use a shell eval to run the command with the URLs passed as arguments. NOTE ABOUT KONQUEROR
When konqueror is specified by a command line option or a configuration variable, we launch kfmclient to try to open the HTML man page on an already opened konqueror in a new tab if possible. For consistency, we also try such a trick if browser.konqueror.path is set to something like A_PATH_TO/konqueror. That means we will try to launch A_PATH_TO/kfmclient instead. If you really want to use konqueror, then you can use something like the following: .ft C [web] browser = konq [browser "konq"] cmd = A_PATH_TO/konqueror .ft Note about git-config --global Note that these configuration variables should probably be set using the --global flag, for example like this: .ft C $ git config --global web.browser firefox .ft as they are probably more user specific than repository specific. See git-config(1) for more information about this. AUTHOR
Written by Christian Couder <chriscool@tuxfamily.org[1]> and the git-list <git@vger.kernel.org[2]>, based on git mergetool by Theodore Y. Ts'o. DOCUMENTATION
Documentation by Christian Couder <chriscool@tuxfamily.org[1]> and the git-list <git@vger.kernel.org[2]>. GIT
Part of the git(1) suite NOTES
1. chriscool@tuxfamily.org mailto:chriscool@tuxfamily.org 2. git@vger.kernel.org mailto:git@vger.kernel.org Git 1.7.1 07/05/2010 GIT-WEB--BROWSE(1)
All times are GMT -4. The time now is 11:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy