Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.78 KB | None | 0 0
  1. #!/bin/bash/
  2.  
  3. if [ $# -ne "1" ]
  4. then
  5. echo "Liczba argumentow nie jest rowna 1"
  6.     exit
  7. fi
  8.  
  9.  
  10. if [ $1 -eq "1" ] 2> /dev/null;  #czy ten argument jest rowny 1
  11. then
  12.     echo -n "Procesor:" > wynik.txt && lshw 2> /dev/null | grep CPU | cut -d : -f 2- >> wynik.txt
  13.     echo -n "Wielkosc pamieci RAM:" >> wynik.txt && lshw 2> /dev/null | grep size | grep iB | cut -d : -f 2- >> wynik.txt
  14.     echo -n "USB:" >> wynik.txt && lshw 2> /dev/null | grep USB | grep product | cut -d : -f 2- >> wynik.txt
  15.     echo -n "Karta dźwiękowa:" >> wynik.txt && lshw 2>/dev/null | grep product | grep Audio | cut -d : -f 2- >> wynik.txt
  16.     mount | cut -d ' ' -f 1-3 | sed -e 's/ on / zamontowane na /g' > test
  17.     echo -n  "Zamontowane partycje: " >> wynik.txt && sed -n "1 p" test >> wynik.txt
  18.     linia=2
  19.     zmienna=$(cat test | wc -l)
  20.     for (( c=2; c<=$zmienna; c++ ))
  21.     do
  22.         echo -n "                      " >> wynik.txt
  23.         wypisz=`sed -n "$linia p" test`
  24.         echo $wypisz >> wynik.txt
  25.         linia=$((linia+1))
  26.     done
  27.     rm test
  28.     echo "KONIEC"
  29.     exit
  30. elif [ $1 -eq "2" ] 2> /dev/null; #czy ten argument jest rowny 2
  31. then
  32.     echo -n "Procesor:" && lshw 2> /dev/null | grep CPU | cut -d : -f 2-  
  33.     echo  -n "Wielkosc pamieci RAM:" && lshw 2> /dev/null | grep size | grep iB | cut -d : -f 2-
  34.     echo -n "USB:" && lshw 2> /dev/null | grep USB | grep product | cut -d : -f 2-
  35.     echo -n "Karta dźwiękowa:" && lshw 2>/dev/null | grep product | grep Audio | cut -d : -f 2-
  36.     mount | cut -d ' ' -f 1-3 | sed -e 's/ on / zamontowane na /g' > test
  37.     echo -n  "Zamontowane partycje: " && sed -n "1 p" test
  38.     linia=2
  39.     zmienna=$(cat test | wc -l)
  40.     for (( c=2; c<=$zmienna; c++ ))
  41.     do
  42.         echo -n "                      "
  43.         wypisz=`sed -n "$linia p" test`
  44.         echo $wypisz
  45.         linia=$((linia+1))
  46.     done
  47.     rm test
  48. else
  49.     echo "Zly parametr wejsciowy"
  50.     exit
  51. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement