echo 到 stderr
This question is old, but you could do this, which facilitates reading:
>&2 echo "error"
The operator '>&2' literally means redirect the address of file descriptor 1 (stdout) to the address of file descriptor 2 (stderr) for that command. depending on how deeply you want to understand it, read this: http://wiki.bash-hackers.org/howto/redirection_tutorial
To avoid interaction with other redirections use subshell
(>&2 echo "error")
echo 到 stderr的更多相关文章
- Shell 之外 试试不操作 shell 来实现同样的效果
执行程序时发生了什么当你双击桌面上的终端程序图标时,就会打开一个载入shell的程序. 你键入的命令不会直接在内核执行,而是先和 shell 进行交互.Command (eg. `ls -l')↓Te ...
- Linux Shell编程(25)——I/O 重定向
默认情况下始终有3个"文件"处于打开状态, stdin (键盘), stdout (屏幕), and stderr (错误消息输出到屏幕上). 这3个文件和其他打开的文件都可以被重 ...
- Working with Python subprocess - Shells, Processes, Streams, Pipes, Redirects
Posted: 2009-04-28 15:20 Tags: Python Note Much of the "What Happens When you Execute a Command ...
- linux shell脚本编程笔记(五): 重定向
I/O重定向 简述: 默认情况下始终有3个"文件"处于打开状态, stdin (键盘), stdout (屏幕), and stderr (错误消息输出到屏幕上). 这3个文件和其 ...
- CentOS下输入输出重定向
nux重定向是指修改原来默认的一些东西,对原来系统命令的默认执行方式进行改变,比如说简单的我不想看到在显示器的输出而是希望输出到某一文件中就可以通过Linux重定向来进行这项工作. Linux默认输入 ...
- Python 调用系统命令的模块 Subprocess
Python 调用系统命令的模块 Subprocess 有些时候需要调用系统内部的一些命令,或者给某个应用命令传不定参数时可以使用该模块. 初识 Subprocess 模块 Subprocess 模块 ...
- Python之subprocess模块的使用
1.subprocess调用系统的命令 #!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess import sys compl ...
- echo输出到stderr
echo "Your error message here" >&2 This is a normal echo (which goes to stdout), ho ...
- [LINK]php的三种CLI常量:STDIN,STDOUT,STDERR
FROM : http://www.cnblogs.com/thinksasa/archive/2013/02/27/2935158.html PHP CLI(command line interfa ...
随机推荐
- $config['base_url'] BASE_URL
/*|------------------------------------------------| Base Site URL|--------------------------------- ...
- Pychorm提示Unresolved reference 导入模块报错
最近使用Pychorm编写Python时,每次要引入自定义模块,就会报错,提示“Unresolved reference” Unresolved reference 'LoginClass' more ...
- Auto-Scaling Web Applications in Clouds: A Taxonomy and Survey读书笔记
这篇文章是发在2018年CSUR上的一篇文章,主要是讲虚拟机上web应用的auto-scaling技术的分类 近年来许多web 应用服务商将他们的应用迁移到云数据中心,为什么要迁移到云上呢?其中一个重 ...
- POJ 3248 Catch That Cow
http://poj.org/problem?id=3278 二维BFS #include <iostream> #include <stdio.h> #include < ...
- vi/vim复制粘贴命令
1. 选定文本块.使用v进入可视模式,移动光标键选定内容. 2.复制的命令是y,即yank(提起) ,常用的命令如下: y 在使用v模式选定了某一块的时候,复制选定块到缓冲区用: ...
- bit manipulation
WIKI Bit manipulation is the act of algorithmically manipulating bits or other pieces of data shorte ...
- SGU 104 Little shop of flowers【DP】
浪(吃)了一天,水道题冷静冷静.... 题目链接: http://acm.sgu.ru/problem.php?contest=0&problem=104 题意: 给定每朵花放在每个花盆的值, ...
- 利用Cufon技术渲染文字的简单示例
Cufon是一种能够根据指定的字体渲染文字的技术.今天试用了下,主要有几个步骤: 1.下载Cufon.js(http://cufon.shoqolate.com/generate/) 2.获取需要渲染 ...
- [转]LINUX新建和增加SWAP分区
以前做过增加swap分区的事情,今天一个同事问到我如何做,故记个笔记整理一下吧.另外,以前我写过“交换分区swap的大小分配”,大家也可先看一下. 我们都知道在安装Linux系统时在分区时可以分配sw ...
- Python遇到的零碎小问题
切记else语句的后面直接加冒号: 字符和数字绝对不能直接相加 对于字符与整数之间的转化 ord('E')可以将其转化为45,chr(65)可以将其转化为A 编写程序的时候尽量要考虑时间复杂度 app ...