Skip to content

Instantly share code, notes, and snippets.

@friendleemachine
Created February 24, 2021 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save friendleemachine/5870cf7ab65960bb82d48bcd3943a72d to your computer and use it in GitHub Desktop.
Save friendleemachine/5870cf7ab65960bb82d48bcd3943a72d to your computer and use it in GitHub Desktop.
#!/bin/bash
#task1
mkdir test
cd test
#task2
ls -a --classify /etc > list
#task3
echo | ls -la /etc | grep -c ^d >> list
echo | ls -1A /etc | wc -l >> list
#task4
mkdir links
cd links
#task5
ln -fd ../list list_hlink
#task6
ln -fs ../list list_slink
#task7
ls -l list_hlink | awk {'print $2'}
ls -l list_slink | awk {'print $2'}
ls -l ../list | awk {'print $2'}
#task8
echo | cat ../list | wc -l >> list_hlink
#task9
cmp -s list_hlink list_slink && echo "task9: YES"
#task10
mv -f ../list ../list1
#task11
cmp -s list_hlink list_slink && echo "task11: YES"
#task12
cd ~
ln test/links/ links_hlink
#task13
ls -a /etc | grep ".conf" > list_conf
#task14
ls -FR /etc | grep ".d/" > list_d
#task15
cat list_conf > list_conf_d
cat list_d >> list_conf_d
#task16
cd test
mkdir .sub
#task17
cp ../list_conf_d .sub
#task18
cp --backup ../list_conf_d .sub
#task19
ls -aFR
#task20
cd ~
man man >> man.txt
#task21
split -b 1K man.txt
#task22
mkdir test/man.dir/
#task23
mv -f x* test/man.dir/
#task24
cat test/man.dir/x* > test/man.dir/man.txt
rm -f test/man.dir/x*
#task25
cmp -s man.txt test/man.dir/man.txt && echo 'task25: YES'
#task26
echo 'someothertext' >> man.txt
#task27
diff -u man.txt test/man.dir/man.txt > diff_man.txt
#task28
mv -f diff_man.txt test/man.dir/
#task29
patch -R test/man.dir/man.txt test/man.dir/diff_man.txt
#task30
cmp -s man.txt test/man.dir/man.txt && echo 'task30: YES'
2
1
2
task9: YES
.:
./
../
links/
list1
man.dir/
.sub/
./links:
./
../
list_hlink
list_slink@
./man.dir:
./
../
diff_man.txt
man.txt
./.sub:
./
../
list_conf_d
list_conf_d~
task25: YES
patching file test/man.dir/man.txt
task30: YES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment