Results 1 to 3 of 3

Thread: Bash script

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User alore's Avatar
    Join Date: Feb:2007
    Location: London
    Posts: 2,800

    Bash script

    . Bash Shell, if-statement.

    Code:
    #!/bin/bash
    
    while read line
    do
    	if [[ "$line" == *PING* ]]
    	then
    	        cut -d ' ' -f 2
    	elif [[ "$line" == *time=* ]]
    	then
    		cut -d ' ' -f 7
    	fi
    done
    .txt ping 100 . []PING[] 2- , []time=[] 7- , (). , cut statement- true false. :

    Code:
    #!/bin/bash
    
    while read line
    do
    	if [[ "$line" == *PING* ]]
    	then
    	        echo "TRUE"
    	elif [[ "$line" == *time=* ]]
    	then
    		echo "FALSE"
    	fi
    done
    , .. if-statement-. cut awk cut/awk true false.

    ?
    NZXT H1 | Ryzen 7 5800X | Asus Strix B450i | 16GB Corsair Vengeance DDR4-3200 | Inno3D GeForce RTX 4070Ti X3 12GB | 1TB PNY XLR8 M.2 NVMe SSD

  2. #2
    Nuclear's Avatar
    Join Date: Sep:2004
    Location: , . ()
    Posts: 3,352
    , - cut -f 7 7 .

    , - cut stdin. while stdin ( stdin ), , .
    . HWBG !

  3. #3
    Registered User alore's Avatar
    Join Date: Feb:2007
    Location: London
    Posts: 2,800
    , loop if-statement, /
    NZXT H1 | Ryzen 7 5800X | Asus Strix B450i | 16GB Corsair Vengeance DDR4-3200 | Inno3D GeForce RTX 4070Ti X3 12GB | 1TB PNY XLR8 M.2 NVMe SSD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |