io-redirection Questions
3
Solved
I have two processes defined by processBuilders:
ProcessBuilder pb1 = new ProcessBuilder (...)
ProcessBuilder pb2 = new ProcessBuilder (...)
I want the output of pb1 to be the input to pb2.
I fo...
Olander asked 29/2, 2016 at 18:32
3
Solved
I am trying to start a process with the Command API and redirect its standard output to standard error. The following fails:
Command::new("tput")
.arg("rc")
.stdout(io::stderr...
Deduct asked 7/2, 2017 at 23:27
4
Solved
I'm having trouble removing the output from the netstat command when I check if a current port is being used. I dont need the output of the command but rather just the error code.
Running netstat...
Dieball asked 16/9, 2015 at 14:45
4
On Windows, one can use > NUL to redirect a pipe to nothing. On Linux, one uses > /dev/null. Is there a cross-platform compatible way to redirect a pipe to nothing for both platforms? In othe...
Inhabit asked 21/8, 2014 at 23:30
3
What I want to do: extract text information from a pdf file and redirect that to a txt file.
What I did:
pip install pdfminor
pdf2txt.py file.pdf > output.txt
What I got:
UnicodeEncodeE...
Reikoreilly asked 17/1, 2020 at 0:14
8
Solved
Is there a way to effectively do this in bash:
/my/bash/script < echo 'This string will be sent to stdin.'
I'm aware that I could pipe the output from the echo such as this:
echo 'This strin...
Riccio asked 30/6, 2011 at 21:7
2
Solved
Consider the following sample script:
#!/bin/sh
do_something() {
echo $@
return 1
}
cat <<EOF > sample.text
This is a sample text
It serves no other purpose
EOF
cat sample.text | whi...
Enliven asked 14/1, 2017 at 14:10
9
Solved
To redirect standard output to a truncated file in Bash, I know to use:
cmd > file.txt
To redirect standard output in Bash, appending to a file, I know to use:
cmd >> file.txt
To redirec...
Billhook asked 18/5, 2009 at 4:19
5
Solved
From this perldoc page,
To capture a command's STDERR and STDOUT together:
$output = `cmd 2>&1`;
To capture a command's STDOUT but discard its STDERR:
$output = `cmd 2>/dev/null`;
To capture ...
Ligate asked 18/10, 2010 at 19:35
2
Solved
What is special about the output message of git fetch command that is printed on the console? I'm not able to use grep, xargs, etc. Not able to redirect the output to a file also..
Note: I'm using...
Oxeyed asked 30/10, 2012 at 19:19
5
Solved
I'm using lldb inside Xcode, and one of my variables contains a huge chunk of JSON data. Using po myVar isn't much helpful to analyse this data, as it will output in the tiny Xcode debug console.
I...
Ursola asked 4/10, 2013 at 8:29
22
Solved
I know it is not recommended, but is it at all possible to pass the user's password to scp?
I'd like to copy a file via scp as part of a batch job and the receiving server does, of course, need a ...
Chromatid asked 8/9, 2008 at 16:35
11
I'm building an opensource project from source (CPP) in Linux. This is the order:
$CFLAGS="-g Wall" CXXFLAGS="-g Wall" ../trunk/configure --prefix=/somepath/ --host=i386-pc --target=i386-pc
$make
...
Sinusoid asked 19/2, 2010 at 15:47
4
Solved
I need to get the file from the terminal, I know the command will look like:
./a.out < fileName.txt
I'm not sure how to use fgets() in my program to use the file requested from the terminal. ...
Choose asked 19/10, 2013 at 15:43
21
Solved
Is it possible to store or capture stdout and stderr in different variables, without using a temp file? Right now I do this to get stdout in out and stderr in err when running some_command, but I'd...
Spanjian asked 14/6, 2012 at 6:19
5
Solved
You can install multiple homebrew formulas by brew install package1 package2. But if you have a text file with all the packages that you would like to install. How would you do it?
brew install &l...
Saunder asked 4/11, 2014 at 14:37
5
Solved
I have a bash script that I want to be quiet when run without attached tty (like from cron).
I now was looking for a way to conditionally redirect output to /dev/null in a single line.
This is an e...
Extreme asked 6/1, 2012 at 10:37
10
Solved
I found this piece of code in /etc/cron.daily/apf
#!/bin/bash
/etc/apf/apf -f >> /dev/null 2>&1
/etc/apf/apf -s >> /dev/null 2>&1
It's flushing and reloading ...
Diley asked 9/5, 2012 at 1:46
6
Solved
I am using PowerShell and am trying to run the following command:
.\test_cfdp.exe < test.full | tee test.log
test.full is a script that mimics command line inputs to test_cfdp.exe. However, I...
Phonolite asked 27/1, 2010 at 16:55
8
Solved
I've a pipline doing just
command1 | command2
So, stdout of command1 goes to command2 , while stderr of command1 go to the terminal (or wherever stdout of the shell is).
How can I pipe stder...
Afterword asked 2/2, 2012 at 13:15
6
Solved
In a PowerShell script automating some SVN tasks I have the following function:
function SvnUrlExists($url)
{
svn info $url | out-null 2>&1
return $?
}
Since this explicitly tests wheth...
Wolfram asked 15/8, 2012 at 12:51
2
Solved
I have the following files:
test.ps1
& e:\test.bat > stdout.txt 2> stderr.txt
test.bat
@echo off
echo write to stdout
echo write to stderr >&2
When I call test.ps1 like this:
pow...
Hedberg asked 3/9, 2022 at 18:1
3
Solved
I was a little confused by this expression:
gcc -c -g program.c >& compiler.txt
I know &>filename will redirect both stdout and stderr to file filename. But in this case the ampersan...
Recognize asked 29/6, 2012 at 2:48
7
Solved
I'm playing with i/o shell redirection. The commands I've tried (in bash):
ls -al *.xyz 2>&1 1> files.lst
and
ls -al *.xyz 1> files.lst 2>&1
There is no any *.xyz file in ...
Sacco asked 31/7, 2013 at 15:58
2
Solved
Doing some maintenance on a script, I found this line:
ping -n 40 127.0.0.1 > NUL 2>&1
I know from this question that everything up to the NUL causes the script to sleep for 39 seconds...
Rigobertorigor asked 13/2, 2017 at 18:56
1 Next >
© 2022 - 2025 — McMap. All rights reserved.