Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.40 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #set -x
  4. LC_ALL=C
  5. d_o_w=$(date +"%u")
  6.  
  7. #mod=$(( $d_o_w % 2 ))
  8. #echo ${mod}
  9. #if [ $(( $d_o_w % 2 )) == 0 ]; then
  10.  
  11. if [ $(( $d_o_w )) == 6 ] || [ $(( $d_o_w )) == 7 ];then
  12.     echo "Dzis piekny wolny dzien"
  13. else
  14.     echo "Dzis smutny pracowity dzien"
  15. fi
  16.  
  17.  
  18.  
  19. #!/bin/bash
  20.  
  21. #set -x
  22.  
  23. n_o_file="$1"
  24.  
  25. for files in "$n_o_file"*.pdf
  26. do
  27.     attachments="$attachments -a ${files}"
  28. done
  29.  
  30. for mails in $(cat adresy.txt)
  31. do
  32.     mail -s "Zapytanie ofertowe" $attachments $mails < tresc.txt   
  33. done
  34.  
  35.  
  36. echo "Wyslane zalaczniki to: "$attachments""
  37. echo "Wyslana tresc to: "$(cat tresc.txt)""
  38. echo "Wyslano na adresy: "$(cat adresy.txt)""
  39.  
  40.  
  41.  
  42. #!/bin/bash
  43.  
  44. #set -x
  45.  
  46. extension="$1"
  47. days="$2"
  48. n_o_tar="$3"
  49.  
  50. files=$(find . -name "*.$extension" -mtime -$days)
  51.  
  52. tar cvf "$n_o_tar".tar.gz $files
  53.  
  54. echo "pliki spakowane do archiwum o nazwie "$n_o_tar".tar.gz"
  55.  
  56.  
  57.  
  58. #! /bin/bash
  59. set -x
  60.  
  61. c_name=0;
  62. c_days=0;
  63. c_n_o_tar=0;
  64. c_extension=0;
  65.  
  66. while getopts ":nmae" OPTION; do
  67.  
  68. case $OPTION in
  69.     n)
  70.     name=$OPTARG
  71.     c_name=1
  72.     ;;
  73.          
  74.     m)
  75.     days=$OPTARG
  76.     c_days=1;
  77.     ;;
  78.  
  79.     a)
  80.     n_o_tar=$OPTARG
  81.     c_n_o_tar=1;
  82.     ;;
  83.  
  84.     e)
  85.     extension=$OPTARG
  86.     c_extension=1;
  87.     ;;
  88.  
  89.     *)
  90.     echo "Błędna opcja"; exit 1;;
  91. esac
  92.  
  93. files=$(find . -name "$name*.$extension" -mtime -$days)
  94.  
  95. tar cvf "$n_o_tar".tar.gz $files
  96.  
  97. echo "pliki spakowane do archiwum o nazwie "$n_o_tar".tar.gz"
  98.  
  99. done
  100.  
  101. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement