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
    
    
  • 相关阅读:
    LeetCode 275. H-Index II
    LeetCode 274. H-Index
    LeetCode Gray Code
    LeetCode 260. Single Number III
    LeetCode Word Pattern
    LeetCode Nim Game
    LeetCode 128. Longest Consecutive Sequence
    LeetCode 208. Implement Trie (Prefix Tree)
    LeetCode 130. Surrounded Regions
    LeetCode 200. Number of Islands
  • 原文地址:https://www.cnblogs.com/yangtao416/p/14822623.html
Copyright © 2011-2022 走看看