Sponsored Content
Full Discussion: Less or echo
Top Forums Shell Programming and Scripting Less or echo Post 302940394 by Don Cragun on Saturday 4th of April 2015 02:32:59 PM
Old 04-04-2015
If you want to print a string, use echo or printf.

If you want to print the contents of a file, use cat.

If you want to print a file that won't fit on a screen and you want your users to be able to scroll up and down, or to be able to search for strings in the file; use less, more, or view. (Or, give your users an option to choose the viewer they want or an environment variable they can set to choose the viewer they want and select and document the default viewer your program will use if the option or environment variable is not set.)

Anytime you dump a user into an external application (such as a file viewer), tell the user what application you're using. That way, they will know what they have to do to get out of it when they're done. (Or, if they aren't familiar with that application, they can use man application to figure out what they need to do.)
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

echo

what is the meaning of this echo $description | wc -m` -ne "1" (0 Replies)
Discussion started by: debasis.mishra
0 Replies

2. UNIX for Dummies Questions & Answers

echo

Is there a way to get echo to make newlines without using any type of quotes? I've done a lot of searches and went into my Linux book to no avail. I'm trying to write five separate lines to a file. I can get echo to accept all five lines like this echo \ \this is line 1\ \this is line 2\ >... (6 Replies)
Discussion started by: Trekker182
6 Replies

3. Shell Programming and Scripting

Difference between using "echo" builtin and /bin/echo

So in my shell i execute: { while true; do echo string; sleep 1; done } | read line This waits one second and returns. But { while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly. I have tried this in bash as well as zsh,... (2 Replies)
Discussion started by: ulidtko
2 Replies

4. Shell Programming and Scripting

echo !.

can someone tell me what does this code do? echo !. (2 Replies)
Discussion started by: ryandegreat25
2 Replies

5. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

6. Shell Programming and Scripting

Help with echo

Hi Guys, I need to print a value in the same line , But when we use the echo instead the loops (while), the value goes to the next line.. Can you help me in this.. Thanks For your help in advance. (6 Replies)
Discussion started by: mac4rfree
6 Replies

7. Shell Programming and Scripting

With that logic this echoes "echo". Question about echo!

echo `echo ` doesn't echoes anything. And it's logic. But echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo" (too much echoing :P):o (2 Replies)
Discussion started by: hakermania
2 Replies

8. Shell Programming and Scripting

tcsh - understanding difference between "echo string" and "echo string > /dev/stdout"

I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here. I have following script (called out_to_streams.csh): #!/bin/tcsh -f echo Redirected to STDOUT > /dev/stdout echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies

9. UNIX for Dummies Questions & Answers

echo

Hello, I'm working with ksh. I was working with the echo command That is echo "Today is $date" which would show for example Toady is 7/12/12 which was fine however, know I only recieve the first part of the echo without the date. Today is Could I have edited the echo... (9 Replies)
Discussion started by: JD_Sal
9 Replies

10. UNIX for Dummies Questions & Answers

Difference between echo `ls -l` and echo "`ls -l`" ?

Hi guys, Been messing around with shell programming for a couple of days and I found something that was pretty odd in the behavior of the echo command. Below is an example-: When I type the following in my /home directory from my lxterminal in Debian-: echo "`ls -l`" I get the... (2 Replies)
Discussion started by: sreyan32
2 Replies
GIT-HELP(1)							    Git Manual							       GIT-HELP(1)

NAME
       git-help - Display help information about Git

SYNOPSIS
       git help [-a|--all] [-g|--guide]
		  [-i|--info|-m|--man|-w|--web] [COMMAND|GUIDE]

DESCRIPTION
       With no options and no COMMAND or GUIDE given, the synopsis of the git command and a list of the most commonly used Git commands are
       printed on the standard output.

       If the option --all or -a is given, all available commands are printed on the standard output.

       If the option --guide or -g is given, a list of the useful Git guides is also printed on the standard output.

       If a command, or a guide, is given, a manual page for that command or guide is brought up. The man program is used by default for this
       purpose, but this can be overridden by other options or configuration variables.

       Note that git --help ... is identical to git help ... because the former is internally converted into the latter.

       To display the git(1) man page, use git help git.

       This page can be displayed with git help help or git help --help

OPTIONS
       -a, --all
	   Prints all the available commands on the standard output. This option overrides any given command or guide name.

       -g, --guides
	   Prints a list of useful guides on the standard output. This option overrides any given command or guide name.

       -i, --info
	   Display manual page for the command in the info format. The info program will be used for that purpose.

       -m, --man
	   Display manual page for the command in the man format. This option may be used to override a value set in the help.format configuration
	   variable.

	   By default the man program will be used to display the manual page, but the man.viewer configuration variable may be used to choose
	   other display programs (see below).

       -w, --web
	   Display manual page for the command in the web (HTML) format. A web browser will be used for that purpose.

	   The web browser can be specified using the configuration variable help.browser, or web.browser if the former is not set. If none of
	   these config variables is set, the git web--browse helper script (called by git help) will pick a suitable default. See git-
	   web--browse(1) for more information about this.

CONFIGURATION VARIABLES
   help.format
       If no command-line option is passed, the help.format configuration variable will be checked. The following values are supported for this
       variable; they make git help behave as their corresponding command- line option:

       o   "man" corresponds to -m|--man,

       o   "info" corresponds to -i|--info,

       o   "web" or "html" correspond to -w|--web.

   help.browser, web.browser and browser.<tool>.path
       The help.browser, web.browser and browser.<tool>.path will also be checked if the web format is chosen (either by command-line option or
       configuration variable). See -w|--web in the OPTIONS section above and git-web--browse(1).

   man.viewer
       The man.viewer configuration variable will be checked if the man format is chosen. The following values are currently supported:

       o   "man": use the man program as usual,

       o   "woman": use emacsclient to launch the "woman" mode in emacs (this only works starting with emacsclient versions 22),

       o   "konqueror": use kfmclient to open the man page in a new konqueror tab (see Note about konqueror below).

       Values for other tools can be used if there is a corresponding man.<tool>.cmd configuration entry (see below).

       Multiple values may be given to the man.viewer configuration variable. Their corresponding programs will be tried in the order listed in
       the configuration file.

       For example, this configuration:

		   [man]
			   viewer = konqueror
			   viewer = woman

       will try to use konqueror first. But this may fail (for example, if DISPLAY is not set) and in that case emacs' woman mode will be tried.

       If everything fails, or if no viewer is configured, the viewer specified in the GIT_MAN_VIEWER environment variable will be tried. If that
       fails too, the man program will be tried anyway.

   man.<tool>.path
       You can explicitly provide a full path to your preferred man viewer by setting the configuration variable man.<tool>.path. For example, you
       can configure the absolute path to konqueror by setting man.konqueror.path. Otherwise, git help assumes the tool is available in PATH.

   man.<tool>.cmd
       When the man viewer, specified by the man.viewer configuration variables, is not among the supported ones, then the corresponding
       man.<tool>.cmd configuration variable will be looked up. If this variable exists then the specified tool will be treated as a custom
       command and a shell eval will be used to run the command with the man page passed as arguments.

   Note about konqueror
       When konqueror is specified in the man.viewer configuration variable, we launch kfmclient to try to open the man page on an already opened
       konqueror in a new tab if possible.

       For consistency, we also try such a trick if man.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:

		   [man]
			   viewer = konq

		   [man "konq"]
			   cmd = A_PATH_TO/konqueror

   Note about git config --global
       Note that all these configuration variables should probably be set using the --global flag, for example like this:

	   $ git config --global help.format web
	   $ git config --global web.browser firefox

       as they are probably more user specific than repository specific. See git-config(1) for more information about this.

GIT
       Part of the git(1) suite

Git 2.17.1							    10/05/2018							       GIT-HELP(1)
All times are GMT -4. The time now is 12:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy