0
0
This commit is contained in:
Guy Baconniere
2021-08-20 10:02:38 +02:00
parent 5aa02c94b5
commit d30270c485
354 changed files with 0 additions and 0 deletions

81
Shell_01/Makefile Normal file
View File

@@ -0,0 +1,81 @@
#
# Copyright (c) 2021 Guy Baconniere.
#
## How to use this Makefile
#
# cd git
# mkdir ex01
# cd ex01
# make -f ../../Makefile ex01
#
marvin = "\"\\\?\$$\*\'MaRViN\'\*\$$\?\\\""
clone:
@git clone git@vogsphere.42lausanne.ch:vogsphere/intra-uuid-a2e8ee6f-787d-4ee8-9eb4-359821770152-3701046 git
ex01:
@rm -f print_groups.sh
@printf "#!/bin/sh\n" > print_groups.sh
@printf "id -Gn \$$FT_USER | tr ' ' ','\n" >> print_groups.sh
@chmod +x print_groups.sh
@FT_USER=daemon ./print_groups.sh | cat -e
ex02:
@rm -f find_sh.sh file?.sh
@touch file1.sh file2.sh file3.sh
@printf "#!/bin/sh\n" > find_sh.sh
@printf "find . -type f -name '*.sh' -exec basename '{}' .sh \;\n" >> find_sh.sh
@chmod +x ./find_sh.sh
@./find_sh.sh | cat -e
@rm -f file?.sh
ex03:
@rm -f count_files.sh file*
@touch file{1..40}
@printf "#!/bin/sh\n" > count_files.sh
@printf "find . \( -type f -o -type d \) | wc -l | tr -d ' '\n" >> count_files.sh
@chmod +x ./count_files.sh
@./count_files.sh | cat -e
@rm -f file*
ex04:
@rm -f MAC.sh
@printf "#!/bin/sh\n" > MAC.sh
@printf "ifconfig | grep -oE 'ether .*' | cut -c7-23\n" >> MAC.sh
@chmod +x ./MAC.sh
@./MAC.sh | cat -e
ex05:
@rm -f -- *MaRV*
@printf "42" > "$(marvin)"
@touch -t 10021221.00 "$(marvin)"
@chmod 0614 "$(marvin)"
@ls -lRA *MaRV* | cat -e
ex06:
@rm -f skip.sh file*
@touch file{1..8}
@printf "#!/bin/sh\n" > skip.sh
@printf "ls -l | awk '{ if ((NR + 1) %% 2 == 0) print \$$0 }'\n" >> skip.sh
@chmod +x ./skip.sh
@./skip.sh | cat -e
@rm -f file*
ex07:
@rm -f r_dwssap.sh
@printf "#!/bin/sh\n" > r_dwssap.sh
@printf "grep -v '^#' /etc/passwd | awk -F ':' '/^FT_LINE1/,/^FT_LINE2/ { n++; login=\$$1; rev=\"rev <<<\"login; rev | getline revlogin; close(rev); print ((n > 1) && ((n+1) %% 2 == 0))? revlogin:login }' | sort -rh | tr '\\\\n' ' ' | sed 's/ $$/./; s/ /, /g;'\n" >> r_dwssap.sh
@chmod +x ./r_dwssap.sh
@./r_dwssap.sh | cat -e
ex08:
@rm -f add_chelou.sh
@printf "#!/bin/sh\n" > add_chelou.sh
@printf "echo Trop chelou de jouer avec tr et de jouer cet escape game.\n" >> add_chelou.sh
@chmod +x ./add_chelou.sh
@./add_chelou.sh | cat -e
all: clone

BIN
Shell_01/fr.subject.pdf Normal file

Binary file not shown.

View File

@@ -0,0 +1,2 @@
#!/bin/sh
id -Gn $FT_USER | tr ' ' ',' | tr -d '\n'

2
Shell_01/git/ex02/find_sh.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
find . -type f -name '*.sh' -exec basename '{}' .sh \;

View File

@@ -0,0 +1,2 @@
#!/bin/sh
find . \( -type f -o -type d \) | wc -l | tr -d ' '

2
Shell_01/git/ex04/MAC.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
ifconfig | grep -oE 'ether .*' | cut -c7-23

View File

@@ -0,0 +1 @@
42

2
Shell_01/git/ex06/skip.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
ls -l | awk '{ if ((NR + 1) % 2 == 0) print $0 }'

2
Shell_01/git/ex07/r_dwssap.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
grep -v "#" /etc/passwd | sed -n 'n;p' | awk -F ':' '{ print $1 }' | rev | sort -r | sed -n "${FT_LINE1-1},${FT_LINE2-42}p" | tr '\n' ' ' | sed 's/ $/./; s/ /, /g'

View File

@@ -0,0 +1,2 @@
#!/bin/sh
id -Gn $FT_USER | tr ' ' ',' | tr -d '\n'

View File

@@ -0,0 +1,2 @@
#!/bin/sh
find . -type f -name '*.sh' -exec basename '{}' .sh \;

View File

@@ -0,0 +1,2 @@
#!/bin/sh
find . \( -type f -o -type d \) | wc -l | tr -d ' '

2
Shell_01/git_old/ex04/MAC.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
ifconfig | grep -oE 'ether .*' | cut -c7-23

View File

@@ -0,0 +1 @@
42

2
Shell_01/git_old/ex06/skip.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
ls -l | awk '{ if ((NR + 1) % 2 == 0) print $0 }'

View File

@@ -0,0 +1,2 @@
#!/bin/sh
awk -F ':' '!/^#/ { n++; login=$1; rev="rev <<<"login; rev | getline revlogin; close(rev); print ((n > 1) && ((n+1) % 2 == 0))? revlogin:login }' /etc/passwd | sort -rh | tr '\n' ' ' | sed 's/ $/./; s/ /, /g;'

21
Shell_01/playlist.html Normal file

File diff suppressed because one or more lines are too long