在新行上发送邮件bash变量

时间:2018-06-19 18:47:35

标签: linux bash outlook mailx

echo $ d产生下面的输出,该输出在每个';'之后用换行分隔

scrollView.scrollTo(0, TextView.getBottom());

当我通过mail命令传递$ d时-

yourview.fullscroll(yourview.FOCUS_DOWN);

结果之间没有换行。

我尝试过:

REVOKE ALL ON URI 'hdfs://nameservice/data/ed_bos_reporting_stg' FROM ROLE ed_bos_reporting; 
REVOKE ALL ON URI 'hdfs://nameservice/data/fq' FROM ROLE ed_edw_telephony_rw; 
REVOKE ALL ON URI 'hdfs://nameservice/data/fq' FROM ROLE edw_rw; 
REVOKE ALL ON URI 'hdfs://nameservice/data/standard_register_mail_piece' FROM ROLE standard_register_mail_piece_rw; 
REVOKE ALL ON URI 'hdfs://nameservice/data/tenant/ed_edw/LSFE_CDC/target_files' FROM ROLE edw_rw; 
REVOKE ALL ON URI 'hdfs://nameservice/data/tenant/ed_standard_register_mail_piece_stg' FROM ROLE ed_standard_register_mail_piece_rw;

还有少数没有运气的人。任何建议/导致文档,将不胜感激。

更新 在gmail中确实可以正常工作。但是不在Outlook中

3 个答案:

答案 0 :(得分:0)

我没有Outlook,也无法检验我的假设,但是Outlook可能要求文本使用\r\n行尾而不是\n行尾。

尝试

sed $'s/$/\r/' <<< "$d" | mail ...

或安装dos2unix并使用

unix2dos <<< "$d" | mail ...

将Linux \n行尾转换为Windows \r\n行尾。

答案 1 :(得分:0)

Outlook似乎从我的邮件中删除了多余的换行符。我可以使用awk来解决问题。

import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.ResultSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class GraphDbConnection {
    private final static Logger log = LoggerFactory.getLogger(GraphDbConnection.class);

    @Autowired
    private Cluster cluster;

    public ResultSet executeQuery(String query) {
        Client client = connect();
        ResultSet results = client.submit(query);
        closeConnection(client);
        return results;
    }

    private Client connect() {
        Client client = null;
        try {
            client = cluster.connect();
        } catch (Exception e) {
            log.error("Error in connecting to host address.", e);
        }
        return client;
    }

    private void closeConnection(Client client) {
        client.close();
    }
}

这将读取每一行,并在末尾用三个空格重新打印。 Outlook现在很高兴。 https://blog.dhampir.no/content/outlook-removes-extra-line-breaks-from-plain-text-emails-how-to-stop-it

答案 2 :(得分:-1)

如果您希望将某个字符上的换行符分隔开,则Get-Content可以满足您的要求:

# add the Citrix snapins
asnp citrix*

# Create a log file
$LogFile = "c:\temp\AddServerstoDG.txt"
# variable where we define what delivery group to add
$strDeliveryGroup = "Cerner - Prod"

"" | Out-File $LogFile

#Loop through each server
Get-Content "C:\temp\servers.txt" | Where {$_} | ForEach-Object {
    $strServer = $_

    try {
        # get the entire server object.  this will let us extract the
        # deliverygroup.  Without doing this and relying on |select caused
        # the delivery group header to come up
        $objServer = Get-BrokerMachine $strServer
    } catch [Citrix.Broker.Admin.SDK.SdkOperationException] {
        $strErrorMessage = $_.Exception.Message
        "Server $strServer" + " does not exist" + "$strErrorMessage" |
            Out-File $LogFile -Append 
        Write-Host "Server Does not Exist"
    } catch {
        Write-Host "some other error"
    }

    # here we are making sure that the machine is not in any workergroup, we
    # will continue only if the DesktopGroupName comes back empty
    if ((!$objServer.DesktopGroupName)) {
        try {
            Add-BrokerMachine $strServer -DesktopGroup $strDeliveryGroup
            "Added Server $strServer" + " to " + "$strDeliveryGroup" |
                Out-File $LogFile -Append 
        } catch [Citrix.Broker.Admin.SDK.SdkOperationException] {
            # this is the only execption that can be thrown here since we
            # have captured the server doesn't exist execption
            Write-Host "Server is already in the Workergroup"
        } catch {
            Write-Host "Some other error"
        }
    } else {
        # we are here because the server already has a delivery group
        # assigned
        Write-Host "server already in another delivery Group"
    }
}

这将删除分号。我敢肯定有一种方法可以不删除它们,但这是我唯一知道的方法。 HTH