Redirect STDERR to tcsh from .aliases

in tcsh I'm trying to redirect STDERR from a command from my .aliases file.

I found that I can redirect STDERR from the command line like this.,.

$ (xemacs > /dev/tty) >& /dev/null

., but when I put this in my .aliases file, I get an alias loop.,.

$ cat .aliases
alias xemacs '(xemacs > /dev/tty ) >& /dev/null'
$ xemacs &
Alias loop.
$

., so I put a backslash in front of the command in .aliases, which allows the command to run.,.

$ cat .aliases
alias xemacs '(\xemacs > /dev/tty ) >& /dev/null'
$ xemacs &
[1] 17295
$ 

., but now I can not give the command any arguments:

$ xemacs foo.txt &
Badly placed ()'s.
[1]    Done                          ( \xemacs > /dev/tty ) >& /dev/null
$ 

Can anyone suggest any solutions? Thank you in advance!


UPDATE: I'm still wondering if you can redirect STDERR to tcsh from .aliases, but as suggested here, I ended up with a shell script:

#!/bin/sh
# wrapper script to suppress messages sent to STDERR on launch
# from the command line.
/usr/bin/xemacs "$@" 2>/dev/null
+3
source share
2 answers

, , - - script:

#!/bin/tcsh

(xemacs $* > /dev/tty ) >& /dev/null
+5

Try

alias emacs '(\emacs \!* > /dev/tty) >& /dev/null'

" ()" - emacs. "\!*" "emacs abc"

(/usr/bin/emacs > /dev/tty) >& /dev/null abc

"\!*", "emacs abc"

(/usr/bin/emacs abc > /dev/tty) >& /dev/null
+2

Source: https://habr.com/ru/post/1697541/


All Articles