aboutsummaryrefslogtreecommitdiff
path: root/shell01
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-07-02 23:44:43 +0200
committerCharles <sircharlesaze@gmail.com>2019-07-02 23:44:43 +0200
commit9bde00749e9944c357267a024b3ec78d81a6799c (patch)
treeda718a1c479f0846d29326c63e925a35c1e9d4ee /shell01
parent194a9c63eea7c053ea8eddcc6e24a5f4053febe7 (diff)
downloadpiscine-9bde00749e9944c357267a024b3ec78d81a6799c.tar.gz
piscine-9bde00749e9944c357267a024b3ec78d81a6799c.tar.bz2
piscine-9bde00749e9944c357267a024b3ec78d81a6799c.zip
c00 start, shell01 ex01 correcion
Diffstat (limited to 'shell01')
-rwxr-xr-xshell01/ex01/print_groups.sh1
-rwxr-xr-xshell01/ex02/find_sh.sh1
-rwxr-xr-xshell01/ex03/count_files.sh1
-rwxr-xr-xshell01/ex04/MAC.sh1
-rw-r--r--shell01/ex05/"\?$*'MaRViN'*$?\"1
-rwxr-xr-xshell01/ex06/skip.sh1
-rwxr-xr-xshell01/ex07/r_dwssap.sh1
-rwxr-xr-xshell01/ex08/add_chelou.sh14
8 files changed, 21 insertions, 0 deletions
diff --git a/shell01/ex01/print_groups.sh b/shell01/ex01/print_groups.sh
new file mode 100755
index 0000000..b3d02de
--- /dev/null
+++ b/shell01/ex01/print_groups.sh
@@ -0,0 +1 @@
+groups $FT_USER | tr " " "," | tr -d "\n"
diff --git a/shell01/ex02/find_sh.sh b/shell01/ex02/find_sh.sh
new file mode 100755
index 0000000..3f13587
--- /dev/null
+++ b/shell01/ex02/find_sh.sh
@@ -0,0 +1 @@
+find . -type f -name "*.sh" | sed "s/.*\///g" | sed "s/\.sh//g"
diff --git a/shell01/ex03/count_files.sh b/shell01/ex03/count_files.sh
new file mode 100755
index 0000000..4b9918a
--- /dev/null
+++ b/shell01/ex03/count_files.sh
@@ -0,0 +1 @@
+echo $(find . -type f -o -type d | wc -w)
diff --git a/shell01/ex04/MAC.sh b/shell01/ex04/MAC.sh
new file mode 100755
index 0000000..8c5f269
--- /dev/null
+++ b/shell01/ex04/MAC.sh
@@ -0,0 +1 @@
+ifconfig -a | grep -E "ether\s([0-9a-f]{2}:){5}[0-9a-f]{2}" | cut -f 1
diff --git a/shell01/ex05/"\?$*'MaRViN'*$?\" b/shell01/ex05/"\?$*'MaRViN'*$?\"
new file mode 100644
index 0000000..f70d7bb
--- /dev/null
+++ b/shell01/ex05/"\?$*'MaRViN'*$?\"
@@ -0,0 +1 @@
+42 \ No newline at end of file
diff --git a/shell01/ex06/skip.sh b/shell01/ex06/skip.sh
new file mode 100755
index 0000000..830c966
--- /dev/null
+++ b/shell01/ex06/skip.sh
@@ -0,0 +1 @@
+ls -l | awk '(NR - 1) % 2 == 0 { print }'
diff --git a/shell01/ex07/r_dwssap.sh b/shell01/ex07/r_dwssap.sh
new file mode 100755
index 0000000..e40a78b
--- /dev/null
+++ b/shell01/ex07/r_dwssap.sh
@@ -0,0 +1 @@
+cat /etc/passwd | sed '/ *#.*/d' | awk 'NR % 2 == 0 { print }' | cut -d : -f 1 | rev | sort -r | awk 'NR >= '$FT_LINE1' && NR <= '$FT_LINE2' { print }' | paste -sd "," - | sed "s/\,/, /g" | sed "s/$/./"
diff --git a/shell01/ex08/add_chelou.sh b/shell01/ex08/add_chelou.sh
new file mode 100755
index 0000000..7cb1112
--- /dev/null
+++ b/shell01/ex08/add_chelou.sh
@@ -0,0 +1,14 @@
+echo $FT_NBR1
+B10_1=$(echo $FT_NBR1 | tr "'\\$(echo '\"')?!" "43210")
+echo $B10_1
+echo $FT_NBR2
+B10_2=$(echo $FT_NBR2 | tr "mrdoc" "43210")
+echo $B10_2
+
+B5_ADD=$(echo "ibase=5; obase=5; $B10_1 + $B10_2" | bc)
+echo "ibase=5;obase=13; $B5_ADD" | bc
+# ADD=$(echo "ibase=5; obase=13; $B10_1 + $B10_2" | bc)
+# echo $ADD
+
+ADD_CONV=$(echo $B5_ADD | tr "0123456789ABC" "gtaio luSnemf")
+echo $ADD_CONV