Questions tagged [stderr]

Standard error is another output stream typically used by programs to output error messages or diagnostics.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

How to redirect after merge [duplicate]

I'm trying to get the exit code of an ls command with no other output. To do this I'm using ls /foo/bar/rak/zif/poo 2>&1 > /dev/null; echo $? But when I do this, I get a ls: cannot access /...
Yehuda's user avatar
  • 301
4 votes
0 answers
203 views

Bash: Stderr being sent to a file (when it shouldn't be!)

The following code is on macOS as part of /etc/bashrc_Apple_Terminal, in order to save and restore the shell state across all open windows and tabs (note that this is therefore the very old bash 3.2....
Andrew Jaffe's user avatar
0 votes
0 answers
36 views

When I ssh to the host in pycharm,after displaying 'Starting the remote IDE backend' for a long time,there shows a Deploy Failed window

Here. They are "nohup:ignoring input" and "stderr is empty". By the way,in the previous try the number of "nohup:ignoring input" was 3. And then I remove that connection ...
Seal Rutger's user avatar
2 votes
2 answers
527 views

When and where are the standard in, out, and error file descriptors first opened in linux?

Where are stdin, stdout, and stderr (the fds) first opened? Is it the kernel that does it? And when and where are the symlinks /dev/std{in,out,err} made? Where is the code that does it? I assume it is ...
Elfen Dew's user avatar
0 votes
1 answer
67 views

Calling a script from within csh with output redirection

What I would want: #!/bin/csh # call /myscriptpath/myscript.any and redirect 2>&1 and get retval and output set my_msg = `/myscriptpath/myscript.any` set my_ret = `echo $?` How to capture the ...
paulj's user avatar
  • 238
1 vote
1 answer
67 views

Find number of process running using fuser

We are using fuse to find the logs associated to particular port. fuser /test/log* This results in a list of logs associated with port How to find the number of lines on the output? I tried with |wc -...
Varja's user avatar
  • 69
4 votes
1 answer
802 views

How can I remove this annoying message: "Failed to find cgroup2 mount"?

I run this command ss -tulpnoea|grep -i water|grep -v 127 Failed to find cgroup2 mount Failed to find cgroup2 mount Failed to find cgroup2 mount Failed to find cgroup2 mount Failed to find cgroup2 ...
elbarna's user avatar
  • 12.7k
0 votes
0 answers
90 views

Already using stderr, how do I detect if there was an error in a bash script

I am backing small databases from several websites and sending the admin an email with the results. I have already directed stderr to send the complete error in the email. Is there a way I can ...
Rohit Gupta's user avatar
1 vote
1 answer
124 views

Redirect stderr doesn't show python input

I am running the following command on the terminal: python -c "input('Message')" 2> log but the Message doesn't appear on the screen. Any ideas why this happens?
ado sar's user avatar
  • 133
3 votes
1 answer
903 views

Make grep exit 1 if found, and exit 0 if not found

I'm creating a simple command to execute within GitHub Actions, which builds a Makefile and returns an error if found (matching Error 1) and success when not found... I seem to either get it to fail ...
Herbie Vine's user avatar
0 votes
1 answer
244 views

Archive verify `gzip -v -t` prints success to stderr or I'm doing something wrong? [duplicate]

I want to add gzip file verification to my backup script. My backup script creates logs for stdout and stderr like this: scp -i $BCKIDENTITYFILE $BCKLOG "$BCKREMOTEUSER"@"$BCKHOST":...
Kamil's user avatar
  • 749
0 votes
0 answers
255 views

How to view the output of a running process in another bash session on mac?

I have a process running and I would like to know what it prints to stdout and stderr. On linux I would do tail -f /proc/<pid>/fd/1 See here How do I do this on macOS?
User12547645's user avatar
0 votes
1 answer
165 views

Log the error for a whole && chain of commands (in Cron jobs)

In one of my cronjobs, I have a long &&-chained command, at the end of which, I put 2>>/home/myparadise/public_html/wp-content/uploads/import/files/raytheon/raytheon_log_error.txt - ...
ptrcao's user avatar
  • 5,655
1 vote
1 answer
11k views

Make apt install ignore missing packages

I often find myself doing this: :~$ sudo apt install php7.4 mysql-server git composer curl apache2 --yes To which I sometimes get this response: Reading package lists... Done Building dependency tree.....
mariano-daniel's user avatar
0 votes
3 answers
692 views

How can I log shell errors in scripts called by a cron job?

This morning I found a message saying just so: EDIT: I add the header of the message as well, so it is clear where it came from. Return-Path: <root@REDACTED> Received: from localhost (localhost [...
Ale's user avatar
  • 187
0 votes
1 answer
881 views

/bin/sh: capture stderr into a variable [duplicate]

In my script, I have a complicated command that generates output both on stdout and stderr. I need to capture both into separate variables: #!/bin/sh A=$(command) How can I "capture" stderr ...
Martin Vegter's user avatar
3 votes
1 answer
47 views

Ambiguous bash stream redirection

I am trying to understand the Bash redirections (3.6. Redirections). I prepared the test envronment and I'm trying to understand the order of operations with redirections and order of created file ...
Benjamin's user avatar
  • 141
1 vote
1 answer
657 views

pipe and tee doesn't receive output in a file..(bash)

I wanted get the resout of ps command to a file like this. (in bash) $ps -eax |& tee list1 and I see many lines from the ps command but the file list1 is empty. How should I do it?
Chan Kim's user avatar
  • 397
0 votes
2 answers
315 views

Fork stdin to stdout & stderr?

I am wondering if it's possible to fork standard input to stdout & stderr? Something like this, $ echo "hi" | fork > std.out 2> std.err $ cat std.out hi $ cat std.err hi Or, am I ...
David Streid's user avatar
0 votes
0 answers
69 views

Questions on shell redirection [duplicate]

I am studying for my RHCSA and already have my Linux+ and I'm trying to better understand shell redirection beyond just understanding the basic use cases and I am trying to grasp it at a deeper ...
Kyle's user avatar
  • 9
0 votes
0 answers
244 views

Exporting Python's script errors/traceback to file with netcat

I have a Python script accessible with netcat: nc 'serverIP' port. The Python script awaits an input from the user. If the input is expected, the script keeps running. If the input is unexpect (e.g. ...
McBonobo's user avatar
0 votes
0 answers
2k views

Xauthority file does not exist - so what?

I run X11 programs on a Linux host, displaying remotely on a Mac running the XQuartz X11 server. First of all, this is all on my private LAN so I don't need to tunnel the X connection through SSH, and ...
q.undertow's user avatar
0 votes
1 answer
50 views

linux contextually process stderr only if present

I want to only have a process called if there actually is a STDERR present, but I don't know how to evaluate if one is actually present or not. This code: errtest() { kubectl get namespace -A ...
Oliver Williams's user avatar
0 votes
2 answers
170 views

Bash receive stderr from a pipe which did not redirect it

Is it possible to receive/redirect the stderr of foo.sh from within bar.sh if called without redirecting it first: foo.sh | bar.sh? foo.sh #!/bin/bash echo "hello world" >&2 bar.sh #!...
Linux User's user avatar
1 vote
0 answers
418 views

BASH - Getting stderr message into a variable to be passed to a trap

My question is relative to Ubuntu 20.04 where I am performing these tasks. I currently pass some state information to a debug trap such as $BASH_COMMAND, $LINENO and $?. I would like to pass any ...
user avatar
1 vote
1 answer
70 views

can't get 2> to work on g++ command line on Ubuntu update

On a remote server that was updated with a newer version of Ubuntu, when I try to redirect stderr it won't work. Using putty from windows, but I've done it on the old server all the time. g++ ...
user3161924's user avatar
0 votes
3 answers
318 views

Using `1>&- 2>&- &' as an alias after a shell command

To run a program with bash in background, with no text output, it is possible to use: 1>&- 2>&- &. I would like to define an alias for this. However, if I write in .bashrc alias ...
BowPark's user avatar
  • 4,905
0 votes
1 answer
568 views

Why isn't "Permission denied" in stderr? [duplicate]

I have a command: mywritercmd -f /tmp/test 2>&1 > log.txt I run in a bash terminal, the command returns error: could not open output file "/tmp/test": Permission denied ...
None's user avatar
  • 647
2 votes
1 answer
406 views

Making Bash send this error to std error

While writing some Lua as a backend for my LuaTeX code I noticed the following. For background, here is the Lua code. This version is standard Lua. But you don't really need to understand Lua to ...
Faheem Mitha's user avatar
  • 35.2k
2 votes
2 answers
1k views

Capture stdout of a crashing program and shell's "segfault error" message

I have a compiled program main.bin that is supposed to print: hello world another line This program generates a segmentation fault right after printing the first line. If I run it in the shell (zsh), ...
onlycparra's user avatar
1 vote
1 answer
778 views

Does redirected stderr remain unbuffered in bash?

{ echo bla1 echo bla2 1>&2 } >>myfile 2>&1 Is there any difference between the two echo-s? The only difference I can think of, if echo bla2 2>&1 retains the unbuffered ...
Zoltan K.'s user avatar
  • 493
0 votes
2 answers
1k views

How to capture output that is going neither to stdout nor to stderr?

As far as I can tell, some of the output generated by the command /usr/bin/modulecmd goes neither to stdout nor stderr, as illustrated by the following example: % /usr/bin/modulecmd bash help null >...
kjo's user avatar
  • 15.3k
1 vote
1 answer
673 views

What type of buffering does stderr use by default (in linux)?

What type of buffering does the standard error stream use by default in Linux?
user486613's user avatar
0 votes
1 answer
100 views

Why is this shell output cannot be written to a file? [duplicate]

I'm working on a linux pinephone script that would launch a touchpad emulator. In order to do so, I need to compare the output string of: ./TouchpadEmulator /dev/input/event2 /dev/input/event1 once I ...
LostNavigator23's user avatar
2 votes
1 answer
222 views

Redirecting output from within disk operations does not work

I am not able to successfully redirect STDOUT+STDERR on commands that operates with disks. Standard redirecting which always works, is somehow now catching the output. Two practical examples: Example ...
Josef Komjati's user avatar
1 vote
1 answer
72 views

bash I/O redirection - how to append to stderr

I have a script that loops over some big collection of data and performs some lenghty operations. Then i need to sort | uniq -c its output. So to let it know that its alive, I print a dot every N ...
murison's user avatar
  • 163
0 votes
0 answers
616 views

RuntimeError: 'v4l2loopback' backend: std::exception

I'm getting above error when I'm trying to execute following piece of code: import pyvirtualcam import numpy as np with pyvirtualcam.Camera(width=1280, height=720, fps=20) as cam: print(f'Using ...
Dileep's user avatar
  • 1
1 vote
1 answer
320 views

process hangs after redirecting stderr using exec

I want to redirect stdout and stderr to 2 pipes one for each to create the pipes I used: mkfifo -m 0666 /var/run/log_stdout.pipe mkfifo -m 0666 /var/run/log_stderr.pipe and it works fine, but ...
yunger's user avatar
  • 11
2 votes
1 answer
383 views

How to check if command had any output (zsh)

I want to print a new line after a command if it had any output (I hope that this will make it more readable once my terminal starts scrolling). I found this: precmd() { precmd() { print &...
user419050's user avatar
1 vote
0 answers
2k views

Where does stdout and stderr go in the background

When processes get executed in the background, for example by using systemd to start the processes at startup, why doesn't the stdout and stderr still appear on the terminal when we access the ...
Engineer999's user avatar
  • 1,151
0 votes
1 answer
357 views

how to get split commands output to file

I want to print output of below command to file, can you help me I tried 2>&1 even 2>> also dd if=/dev/random bs=1 count=1000 status=progress |split -b 10 -a 10 I have other dd command ...
Samurai's user avatar
  • 55
0 votes
1 answer
519 views

Redirect systemd service STDERR to command (sendmail)

This seems like something that's been asked before but I can't find it anywhere. I have a systemd service that runs on a timer, updating my packages. I want to get emailed using ssmtp every time the ...
ki9's user avatar
  • 413
1 vote
0 answers
222 views

How to get stderr separate from stdout in task-spooler jobs

I am trying to get a separate output file for stderr for jobs sent to task-spooler on Ubuntu 20.04. This command works fine: tsp -Lfetcher sh -c 'curl -v https://google.com' But I am having trouble ...
turtlemonvh's user avatar
0 votes
2 answers
907 views

redirect stdout and stderr to null in the middle of a chain of '&&'s

TL;DR I've researched this, and you can see what I've found in the More Details and My Attempts section. My command is date && echo "hi 1" && echo "1/0" | bc >/...
bballdave025's user avatar
3 votes
1 answer
640 views

Additional file descriptor for debugging and piped output (logging, metrics, etc)

For a bash script project, I write human-readable log info to stdout/stderr. Additionally, I want to write formatted metrics to a third stream that will be discarded by default but can be redirected ...
Mazzen's user avatar
  • 33
1 vote
1 answer
435 views

Send debug output to terminal multiplexer

Given a shell script (bash in this example), one can use the set -x or -x passed to bash or other supporting shells to generate debug output. I know how to redirect said output to a file ./script.sh 2&...
Nordine Lotfi's user avatar
5 votes
1 answer
2k views

Separate stdout and stderr for `docker run`?

Can I get separate stdout and stderr pipes for docker run? Example: $ docker run --rm -it alpine sh -c 'echo this is stdout; echo this is stderr >&2' \ 2> stderr.txt this is stdout this is ...
laktak's user avatar
  • 5,976
-3 votes
2 answers
636 views

Standard error to standard output - is there other options beside redirection?

I have very limited understanding about standard error and standard output... One of the common methods is to redirect standard error to standard output. Does it mean that error (which usually goes to ...
user avatar
0 votes
1 answer
13k views

Issue passing newline `\n` character to curl command

My Jenkins multiline parameter is read in a variable SERVER_IP which is passed to Unix curl command as below: The curl command triggers a webpage(Jenkins Build) and passes the parameters to the ...
Ashar's user avatar
  • 491
0 votes
1 answer
2k views

How to stop stderr output from gcloud command in cron script without stopping all error output?

I have a bash script for a cron job that uses Google Cloud SDK's gcloud command after some conditional statements. eg. gcloud compute firewall-rules update allow-ssh --source-ranges=$(echo "${...
paradroid's user avatar
  • 1,203

1
2 3 4 5