Shell basic syntax --- shell script script has input and output effects

Enter the shell script

  • Syntax: read - Parameters

  • -p: given prompt. Not supported by default "\ n" newline

  • -s: hidden input content

  • -t: given the waiting time, the timeout will exit read, in seconds

  • -n: to limit the number of characters read, the trigger threshold is automatically executed

1 ! # / Bin / bash
 2  
3 the Read -t 5 -p " Enter: " param
 4 echo " you enter: $ {param} "

 

shell script output color

  • Syntax; echo -e "\ 033 [Word background color; font color; effects string m \ 033 [Close Properties"
# Font color range: 30 - 37 
    echo -e " \ 033 [30m black word \ 033 [0m " 
    echo -e " \ 033 [31M red word \ 033 [0m " 
    echo -e " \ 033 [32M green word \ 033 [0m " 
    echo -e " \ 033 [33m yellow word \ 033 [0m " 
    echo -e " \ 033 [34m blue word \ 033 [0m " 
    echo -e " \ 033 [35m purple word \ 033 [0m " 
    echo -e " \ 033 [36M sky blue word \ 033 [0m " 
    echo -e "\ 033 [37m white word \ 033 [0m" 
    
# Word Background color range: 40 - 47 
    echo -e " \ 033 [40; 37m on black \ 033 [0m " 
    echo -e " \ 033 [41 is; 30m black on red \ 033 [0m " 
    echo -e " \ 033 [42 is; 34m blue characters on a green background \ 033 [0m " 
    echo -e " \ 033 [43 is; 34m blue on a yellow background \ 033 [0m " 
    echo -e " \ 033 [44 is; 30m blue black \ 033 [0m " 
    echo -e " \ 033 [45; 30m purple black bottom \ 033 [0m " 
    echo -e " \ 033 [46 is; 30m sky blue black \ 033 [0m "
    ECHO -e" \ 033 [47; 34m white with blue letters \ 033 [0m " 
    
# effect area 
    echo -e " \ 033 [0m no effect \ 033 [0m " 
    echo -e " \ 033 [1M high brightness \ 033 [0m " 
    echo -e " \ 033 [4M underscore \ 033 [0m " 
    echo -e " \ 033 [flashing 5m \ 033 [0m "
  • Output line feed: echo -e '\ n'
. 1 ! # / Bin / the bash
 2  
. 3 echo -e " \ 033 [37 [; 31 is; 5m note \ 033 [0m "   # flashes red and white

 

Guess you like

Origin www.cnblogs.com/chusiyong/p/11273845.html