echo$home linux
2014-01-07 14:38:29 yusiyuuestc 阅读数 2027
[root@localhost /]# [ -z  "$HOME" ];echo $?

1

运行句代码不是很懂,故上网搜索,得到的答案如下:

回复次数:3

2009-02-20 12:14:00 iteye_8623 阅读数 60

Linux - echo

ECHO(1) User Commands ECHO(1)



NAME
echo - display a line of text

SYNOPSIS
echo [OPTION]... [STRING]...

DESCRIPTION
Echo the STRING(s) to standard output.

-n do not output the trailing newline

-e enable interpretation of backslash escapes

-E disable interpretation of backslash escapes (default)

--help display this help and exit

--version
output version information and exit

If -e is in effect, the following sequences are recognized:

/0NNN the character whose ASCII code is NNN (octal)

// backslash

/a alert (BEL)

/b backspace

/c suppress trailing newline

/f form feed

/n new line

/r carriage return

/t horizontal tab

/v vertical tab

NOTE: your shell may have its own version of echo, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports.

AUTHOR
Written by FIXME unknown.

REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.

COPYRIGHT
Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
The full documentation for echo is maintained as a Texinfo manual. If the info and echo programs are properly installed at your site, the command
info echo

should give you access to the complete manual.



GNU coreutils 6.9.92.4-f088d-dirtJanuary 2008 ECHO(1)

[Linux- 相关问题]

col
echo
test

2009-08-06 10:11:00 yangsc1984 阅读数 437

linux echo
功能说明:显示文字。
  语   法:echo [-ne][字符串]或 echo [--help][--version]
  补充说明:echo会将输入的字符串送往标准输出。输出的字符串间以空白字符隔开, 并在最后加上换行号。
  参   数:-n 不要在最后自动换行
        -e 若字符串中出现以下字符,则特别加以处理,而不会将它当成一般
          文字输出:
          /a 发出警告声;
          /b 删除前一个字符;
          /c 最后不加上换行符号;
          /f 换行但光标仍旧停留在原来的位置;
          /n 换行且光标移至行首;
          /r 光标移至行首,但不换行;
          /t 插入tab;
          /v 与/f相同;
          // 插入/字符;
          /nnn 插入nnn(八进制)所代表的ASCII字符;
        --help 显示帮助
        --version 显示版本信息

2016-01-29 17:59:30 youthtail 阅读数 236

echo -n "hello"  不换行输出

echo -e "hello"  处理“”里的特殊字符

\a 发出警告声

\b 删除前一个字符

\n 换行

echo -e "hello\a"

$hello并发出警告声

echo “hello\a”

$hello\a

echo -e "hello\n"

hello

.......


2016-07-11 18:31:25 lile777 阅读数 1127

输出换行 echo -e

echo -e 处理特殊字符

若字符串中出现以下字符,则特别加以处理,而不会将它当成一般文字输出:
\a 发出警告声;
\b 删除前一个字符;
\c 最后不加上换行符号;
\f 换行但光标仍旧停留在原来的位置;
\n 换行且光标移至行首;
\r 光标移至行首,但不换行;
\t 插入tab;
\v 与\f相同;
\ 插入\字符;
\nnn 插入nnn(八进制)所代表的ASCII字符;


///// 解析字符串内的转义字符

    char ini_file[] = {
        "[file00]\n"
        "path      = ./demo_ini/demo.h264\n"
        "width     = 1920\n" 
        "height    = 1080\n"
        "enable    = 1\n"
        "codec     = h264\n"
        "numbuf    = 0\n"
        "displaydelay    = 0\n"
    };

    char cmd_buf[200] = {0};
    /* 用 "" 包含命令字符串, 避免被截断*/
    sprintf(cmd_buf, "echo -e \"%s\" > %s", ini_file, INI_PATH);
    system(cmd_buf);
# cat ./demo_ini/demo.ini 
 [file00]
path      = ./demo_ini/demo.h264
width     = 1920
height    = 1080
enable    = 1
codec     = h264
numbuf    = 0
displaydelay    = 0

# 

输出不换行 echo -n

root@ubuntu:/# echo  "123\n456"
123\n456
root@ubuntu:/# echo  -n "123\n456"
123\n456root@ubuntu:/# 
root@ubuntu:/# echo  -e "123\n456"
123
456
root@ubuntu:/# 

echo 追加至文件

在Shell编程过程很多时候会使用echo 并输入到日志文件中。写日志的时候有两种情况,一种是一次写入文件空,再写的时候就将之前的内容给覆盖掉,如何实现追加内容呢?
1.覆盖写入

      echo "日志内容"  > 文件

2.追加写入

      echo "日志内容"    >> 文件

Linux - echo

阅读数 939

linux echo

阅读数 242

linux - echo

阅读数 294

Linux:echo $?

阅读数 778

该指令,会返回什么呢?

博文 来自: Administrator4

linux /home

阅读数 51

没有更多推荐了,返回首页