1

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++ filename 2> whatever.txt

just says

g++: error: 2: No such file or directory

When I click the up arrow to bring it back it shows the command with a space between 2 and > as:

g++ filename 2 > whatever.txt

What the heck is going on here? Any ideas?

2
  • 1
    Does the same thing happen if you try it while directly logged into the Ubuntu machine or if you use a different terminal program like MobaXterm or if Windows, the DOS shell or Powershell? Jan 5, 2022 at 1:32
  • yes, it turns out the server defaulted to CSH which doesn't support 2> Jan 5, 2022 at 2:31

1 Answer 1

2

The problem was the shell was csh which doesn't support that.

To find if you're using it use: echo $0

1
  • Note that csh supports cmd >& file to redirect both stdout and stderr to file (zsh and bash did copy that from csh; though there that overlaps with the >& 2 Bourne syntax) Jan 5, 2022 at 8:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .