This commit is contained in:
sfigato 2019-05-11 14:17:48 +02:00
commit beee2bf6f8
14 changed files with 75 additions and 0 deletions

4
01-copy_files/01.sh Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
touch pippo.txt
ls -l pippo.txt

4
01-copy_files/02.sh Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
cp pippo.txt pluto.prova
ls -l pluto.prova

3
02-create_dirs/01.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
mkdir scatolone

3
02-create_dirs/02.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
chmod a-rw scatolone

14
02-create_dirs/03.sh Normal file
View File

@ -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

4
03-mv_files/01.sh Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
mkdir Archivio
mv ../02-create_dirs/2019* Archivio

10
03-mv_files/02.sh Normal file
View File

@ -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

3
04-search_files/01.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
find / -name passwd

4
04-search_files/02.sh Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
find / -ctime -7
find / -mtime -7

3
04-search_files/03.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
find / -name "conf*" -type d

3
05-search_text/01.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
curl http://world.std.com/~wij/dante/paradiso.txt -s|grep -i beatrice

3
05-search_text/02.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
curl http://world.std.com/~wij/dante/inferno.txt -s|grep "[0-9]"

7
05-search_text/03.sh Normal file
View File

@ -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\)"

10
06-replace_text/01.sh Normal file
View File

@ -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