zoukankan      html  css  js  c++  java
  • shell 普通符号

    普通符号:

    $
    1.取变量                        echo $LANG
    2.awk取列                       awk {print $1}  /etc/passwd
    3.提示登录的用户是否为普通用户     rongbiz@rongbiz-Super-Server:~$
    
    ! 排除 取反 的意思
    find ./ -name "*.txt" ! -name "oldboy.txt"
    ./oldgril.txt
    ./olddog.txt
    
    

    | 将前一个命令的执行结果抛给后方

    rongbiz@rongbiz-Super-Server:~/test$ find ./ -name "*.txt"|xargs ls -l
    -rw-rw-r-- 1 rongbiz rongbiz 0 5月  28 14:53 ./oldboy.txt
    -rw-rw-r-- 1 rongbiz rongbiz 0 5月  28 14:53 ./olddog.txt
    

    #

    1 注释
    2 身份标识符
    

    ''

    所见即所得
    root@rongbiz:~/test# echo '$LANG'
    $LANG
    root@rongbiz:~/test# echo "$LANG"
    C.UTF-8
    

    “”

    可以解析变量  执行命令
    root@rongbiz:~/test# echo "$LANG"
    C.UTF-8
    root@rongbiz:~/test# echo "$((1 +1))"
    2
    

    ``

    命令先执行
    

    > >> < << 2> 2>&1=&>>

    >
    输出重定向
    >>
    输出追加重定向
    <
    输入重定向
    <<
    输入追加重定向
    2>
    错误输出重定向
    2>&1=&>>
    root@rongbiz:~/test# ech 1  >>1.txt 2>&1 
    root@rongbiz:~/test# echo 1  >>1.txt 2>&1 
    root@rongbiz:~/test# cat 1.txt 
    
    Command 'ech' not found, did you mean:
    1
    

    逻辑运算符

    && 前一个命令执行成功再执行后一个命令
    [root@iZbp130bctfwzi3oasr6raZ ~]# ls && ls
    c2p14.tar  test.sh
    c2p14.tar  test.sh
    [root@iZbp130bctfwzi3oasr6raZ ~]# lsss && ls
    -bash: lsss: command not found
    
    
    || 前一个命令执行失败执行后面的命令
    [root@iZbp130bctfwzi3oasr6raZ ~]# lsss || ls
    -bash: lsss: command not found
    c2p14.tar  test.sh
    [root@iZbp130bctfwzi3oasr6raZ ~]# ls -l  || ls
    total 2360748
    -rw------- 1 root root 2417395200 May 27 09:11 c2p14.tar
    -rw-r--r-- 1 root root        314 May 24 15:31 test.sh
    
    
  • 相关阅读:
    2020.1.15考试总结
    P4558 [JSOI2018]机器人 结论&DP
    2020.1.11考试总结
    2020.1.9考试总结
    如何和出题人斗智斗勇?奇技淫巧汇总
    各种公式总结
    2020.1.5考试总结
    C基础学习笔记——01-C基础第10天(内存结构)
    C基础学习笔记——01-C基础第09天(指针下)
    C基础学习笔记——01-C基础第08天(指针上)
  • 原文地址:https://www.cnblogs.com/yangtao416/p/14822623.html
Copyright © 2011-2022 走看看