commit beee2bf6f8a301db346380e3f9e81526efdcbfcf Author: Blallo Date: Sat May 11 14:17:48 2019 +0200 Init diff --git a/01-copy_files/01.sh b/01-copy_files/01.sh new file mode 100644 index 0000000..9d8f047 --- /dev/null +++ b/01-copy_files/01.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +touch pippo.txt +ls -l pippo.txt diff --git a/01-copy_files/02.sh b/01-copy_files/02.sh new file mode 100644 index 0000000..6cba162 --- /dev/null +++ b/01-copy_files/02.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cp pippo.txt pluto.prova +ls -l pluto.prova diff --git a/02-create_dirs/01.sh b/02-create_dirs/01.sh new file mode 100644 index 0000000..22a4770 --- /dev/null +++ b/02-create_dirs/01.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +mkdir scatolone diff --git a/02-create_dirs/02.sh b/02-create_dirs/02.sh new file mode 100644 index 0000000..9d5640a --- /dev/null +++ b/02-create_dirs/02.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +chmod a-rw scatolone diff --git a/02-create_dirs/03.sh b/02-create_dirs/03.sh new file mode 100644 index 0000000..3e8985f --- /dev/null +++ b/02-create_dirs/03.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + + +START=$(date --date="20190101" +%s) +LEN=$(date +%j) + + +for INTDATE in $(seq $LEN) +do + DELTA=$(( INTDATE*86400 )) + TIME=$(( START+DELTA )) + DATE=$(date --date="@${TIME}" +%Y%m%d) + mkdir $DATE +done diff --git a/03-mv_files/01.sh b/03-mv_files/01.sh new file mode 100644 index 0000000..d355946 --- /dev/null +++ b/03-mv_files/01.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +mkdir Archivio +mv ../02-create_dirs/2019* Archivio diff --git a/03-mv_files/02.sh b/03-mv_files/02.sh new file mode 100644 index 0000000..be15767 --- /dev/null +++ b/03-mv_files/02.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +cd Archivio +mkdir {Mon,Tue,Wed,Thu,Fri,Sat,Sun} + +for FOLDER in $(ls -1 2019*) +do + DAY=$(date --date=${FOLDER%:} +%a) + mv ${FOLDER%:} $DAY +done diff --git a/04-search_files/01.sh b/04-search_files/01.sh new file mode 100644 index 0000000..592247c --- /dev/null +++ b/04-search_files/01.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +find / -name passwd diff --git a/04-search_files/02.sh b/04-search_files/02.sh new file mode 100644 index 0000000..183682c --- /dev/null +++ b/04-search_files/02.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +find / -ctime -7 +find / -mtime -7 diff --git a/04-search_files/03.sh b/04-search_files/03.sh new file mode 100644 index 0000000..bd7446f --- /dev/null +++ b/04-search_files/03.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +find / -name "conf*" -type d diff --git a/05-search_text/01.sh b/05-search_text/01.sh new file mode 100644 index 0000000..298ac6f --- /dev/null +++ b/05-search_text/01.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +curl http://world.std.com/~wij/dante/paradiso.txt -s|grep -i beatrice diff --git a/05-search_text/02.sh b/05-search_text/02.sh new file mode 100644 index 0000000..0f3ffbd --- /dev/null +++ b/05-search_text/02.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +curl http://world.std.com/~wij/dante/inferno.txt -s|grep "[0-9]" diff --git a/05-search_text/03.sh b/05-search_text/03.sh new file mode 100644 index 0000000..b121c40 --- /dev/null +++ b/05-search_text/03.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +wget http://world.std.com/~wij/dante/inferno.txt +wget http://world.std.com/~wij/dante/purgatorio.txt +wget http://world.std.com/~wij/dante/paradiso.txt + +grep -i -r "\(virgilio\|beatrice\|dio\)" diff --git a/06-replace_text/01.sh b/06-replace_text/01.sh new file mode 100644 index 0000000..e4a75df --- /dev/null +++ b/06-replace_text/01.sh @@ -0,0 +1,10 @@ +#!/usr/env/bin bash + +cp ../05-search_text/*txt . + +for TEXT in *txt +do + sed -i"" "s/Virgilio/PLACEHOLDER/g" $TEXT + sed -i"" "s/Beatrice/Virgilio/g" $TEXT + sed -i"" "s/PLACEHOLDER/Beatrice/g" $TEXT +done