Questions tagged as ['redirect']

Redirection is the switching of a standard stream of data so that it comes from a source other than its default source or so that it goes to some destination other than its default destination.
Score: 4
cocomac avatar
How to hide output of first command when using the || operator and exit?
cn flag

This hides output from the first command, and prints Oops to stderr if it fails. So far, so good.

#!/usr/bin/env bash
invalid_command > /dev/null 2>&1 || >&2 echo "Oops"
echo hi

That outputs this:

Oops
hi

But I need to exit as well as printing a message if the first command failed. So I tried using parenthesis.

#!/usr/bin/env bash
invalid_command > /dev/null 2>&1 || ( > ...
Score: 0
Pants avatar
New server, aliases file doesn't work, virtual does
cn flag

So, my question is: Why doesn't postfix simply use /etc/aliases to redirect incoming mail to external email addresses like I'm used to when I used ubuntu 16.04LTS?

Follow up question: Is there a simpler way to use /etc/postfix/virtual that I'm missing?

I have a new server and the email handling doesn't work the way I'm used to. I've spent most of the day scouring tutorials and manuals, but am still ...

Score: 0
2 domains 1 Ubuntu 2 Spring servers
ru flag

I have 2 domains reditected (using A record) to one IP where Ubuntu server lives. All incoming requests go to running Spring Boot on port 80 (which works now). But I would like to run 2 Spring Boot apps. The first one for request using domain1.com and the second for requests using domain2.com.

Any ideas?

Score: 3
How to append date and text to a file as an alias?
pl flag

I want to create an alias to append a dated note to a file. (The use case I want to reproduce : Sebastian Daschner - How to do effective note taking as developer.

So far I was able to append the date, but I cannot figure out a way to append both the date and the note from user input.

Usage

append-to-file 'my text'

Expected result in file.txt

2021-08-30 : some previous text
2021-09-01 : my text
 ...