Hi, Due to [1] I use "|| exit -2" to break script on a command execution failure in my backup script.
However, I also want to have output written to a file. The following solution writes logs to a file, but silently ignores any failure in "my-backup": > my-backup 2>&1 | tee -a /tmp/some-log || exit -2 I tried to keep the error in a variable (to check its state later on and fail), but it breaks output redirection at all: > my-backup 2>&1 || set ERR2 -2 | tee -a /tmp/some-log || exit -3 Maybe keeping the first two commands in (logical) brackes would help, but () are in Fish reserved for something else. Is it possible in Fish to have a construction that allows to: 1. Run command and have output redirected (e.g. with "tee") also to a file (at least) in a case of success. 2. Break further commands execution in a case of failure (with "|| exit -2" or anything else). ? [1] - https://github.com/fish-shell/fish-shell/issues/2389 Marcin -- https://blog.solidsoft.info/ - Working code is not enough _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users