Sponsored Content
Full Discussion: Question on bash redirection
Top Forums UNIX for Beginners Questions & Answers Question on bash redirection Post 303035997 by MadeInGermany on Wednesday 12th of June 2019 01:51:45 AM
Old 06-12-2019
x < y means: run command x and feed its input (stdin) from file y.
It is true that file y is opened for reading before command x runs.
diff <(sort testfile.txt) <(sort testfile2.txt) means: open a device ("/dev/fd/..."), run sort and redirect its output to the device, open another device, run another sort and redirect its output, run diff with the two devices as arguments (that diff treats as input filenames).
Quote:
man bash
...
Process substitution
...
The process list is run asynchronously, and its input or output appears as a filename. This filename is passed as an argument to the current command as the result of the expansion. If the >(list) form is used, writing to the file will provide input for list. If the <(list) form is used, the file passed as an argument should be read to obtain the output of list. Note that no space may appear between the < or > and the left parenthesis, otherwise the construct would be interpreted as a redirection. Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files.
...
This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash multiple output redirection

Hello all. Is there a way to redirect output to more than one file at a time? I have a method1() that writes to a logfile. In the method cksums are done on files by doing a "for i in `ls`; do cksum $i > $LOGFILE done " In the logfile I want to show the cksums under each directory like... (2 Replies)
Discussion started by: yoi2hot4ya
2 Replies

2. Shell Programming and Scripting

question on redirection (<<)

I came across the following problem, where file contents are overwritten using redirection. Can somebody please explain what cat << BAR seems to be doing and say why this is a problem? Explain the contents and relation between the two filenames used before the cat command. thanks /tmp# echo... (2 Replies)
Discussion started by: newkidintown
2 Replies

3. Shell Programming and Scripting

input redirection question

Hi, in my script I need to execute the following command: query $id 456 432 but it waits for a RETURN character from keyboard and therefore, it fails. I tried something like: query $id 456 432 << '\n' but, i'ts clear it is not correct. Is there any way to do this? Thxs. (0 Replies)
Discussion started by: luistid
0 Replies

4. Shell Programming and Scripting

File redirection question

Hi all, I am working with the Grinder tool (unrelated to my question) to redirect the output of a program to a file as follows: java -cp $CLASSPATH net.grinder.TCPProxy > grinder.txt This is a proxy server which pipes output to a file. When I do something on my proxy, more and more goes to... (1 Reply)
Discussion started by: Annorax
1 Replies

5. Shell Programming and Scripting

BASH Problem / Question regarding redirection

Hi all, Maybe someone is able to help: Need to redirect the output of a command in realtime to a second command. Command-A executes a remote shell to another host, and outputs its results. Command-B displays a "dialog" with the outputs of Command-A. Command-A Output: Updating FileA... (2 Replies)
Discussion started by: mharald
2 Replies

6. Shell Programming and Scripting

Redirection Question

I just wondered if I'm understanding this command line correctly cat 2>save1 0<memo | sort 2>save2 1>letter This means that stdin will read from memo and if there is an error then stderr will write to save1. Am I correct in saying that the sort command will sort the memo file and write... (2 Replies)
Discussion started by: snag49ers
2 Replies

7. Shell Programming and Scripting

Question about IO redirection

for shell operators like <, >, <<, and >> do the LHS always have to be a process or device and the RHS a file or device? Is it possible for the RHS to be a process? (1 Reply)
Discussion started by: stevenswj
1 Replies

8. Shell Programming and Scripting

Redirection question

I want to redirect stderr and have the following peice of code $ cat t1.ksh #!/bin/ksh func2() { diff /tmp/jdlkwjdlkejew /tmp/djlkwejdlewdjew >$OUTPUT_FILE 2>>$ERR_FILE } func1() { let counter=0 while do print -u2 "Error: In main function" func2 let... (1 Reply)
Discussion started by: BeefStu
1 Replies

9. Shell Programming and Scripting

Error redirection question

Hi gurus, I have a question, need some of your inputs... I have a command like this : export LINE_COUNT=`wc -l test.dat | awk '{print $1}'` echo $LINE_COUNT --- > gives me 2 which is fine as the file has 2 lines. This works fine if the file test.dat is present but in case... (3 Replies)
Discussion started by: calredd
3 Replies

10. Shell Programming and Scripting

Input redirection within bash script

Hi, when I try to redirect input and the command is described as a string within an array redirection does not work. why? #!/bin/bash dir=("tail < ./hello.txt") tail < ./hello.txt #works ${dir} #does not work (2 Replies)
Discussion started by: heinzel
2 Replies
GIT-DIFFTOOL(1) 						    Git Manual							   GIT-DIFFTOOL(1)

NAME
git-difftool - Show changes using common diff tools SYNOPSIS
git difftool [<options>] [<commit> [<commit>]] [--] [<path>...] DESCRIPTION
git difftool is a Git command that allows you to compare and edit files between revisions using common diff tools. git difftool is a frontend to git diff and accepts the same options and arguments. See git-diff(1). OPTIONS
-d, --dir-diff Copy the modified files to a temporary location and perform a directory diff on them. This mode never prompts before launching the diff tool. -y, --no-prompt Do not prompt before launching a diff tool. --prompt Prompt before each invocation of the diff tool. This is the default behaviour; the option is provided to override any configuration settings. -t <tool>, --tool=<tool> Use the diff tool specified by <tool>. Valid values include emerge, kompare, meld, and vimdiff. Run git difftool --tool-help for the list of valid <tool> settings. If a diff tool is not specified, git difftool will use the configuration variable diff.tool. If the configuration variable diff.tool is not set, git difftool will pick a suitable default. You can explicitly provide a full path to the tool by setting the configuration variable difftool.<tool>.path. For example, you can configure the absolute path to kdiff3 by setting difftool.kdiff3.path. Otherwise, git difftool assumes the tool is available in PATH. Instead of running one of the known diff tools, git difftool can be customized to run an alternative program by specifying the command line to invoke in a configuration variable difftool.<tool>.cmd. When git difftool is invoked with this tool (either through the -t or --tool option or the diff.tool configuration variable) the configured command line will be invoked with the following variables available: $LOCAL is set to the name of the temporary file containing the contents of the diff pre-image and $REMOTE is set to the name of the temporary file containing the contents of the diff post-image. $MERGED is the name of the file which is being compared. $BASE is provided for compatibility with custom merge tool commands and has the same value as $MERGED. --tool-help Print a list of diff tools that may be used with --tool. --[no-]symlinks git difftool's default behavior is create symlinks to the working tree when run in --dir-diff mode and the right-hand side of the comparison yields the same content as the file in the working tree. Specifying --no-symlinks instructs git difftool to create copies instead. --no-symlinks is the default on Windows. -x <command>, --extcmd=<command> Specify a custom command for viewing diffs. git-difftool ignores the configured defaults and runs $command $LOCAL $REMOTE when this option is specified. Additionally, $BASE is set in the environment. -g, --gui When git-difftool is invoked with the -g or --gui option the default diff tool will be read from the configured diff.guitool variable instead of diff.tool. See git-diff(1) for the full list of supported options. CONFIG VARIABLES
git difftool falls back to git mergetool config variables when the difftool equivalents have not been defined. diff.tool The default diff tool to use. diff.guitool The default diff tool to use when --gui is specified. difftool.<tool>.path Override the path for the given tool. This is useful in case your tool is not in the PATH. difftool.<tool>.cmd Specify the command to invoke the specified diff tool. See the --tool=<tool> option above for more details. difftool.prompt Prompt before each invocation of the diff tool. SEE ALSO
git-diff(1) Show changes between commits, commit and working tree, etc git-mergetool(1) Run merge conflict resolution tools to resolve merge conflicts git-config(1) Get and set repository or global options GIT
Part of the git(1) suite Git 1.8.5.3 01/14/2014 GIT-DIFFTOOL(1)
All times are GMT -4. The time now is 04:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy