From 010f41ddf9283c4d369f8f43aea576c91c52a828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Wed, 30 Mar 2022 19:47:39 +0200 Subject: [PATCH] Add ISO/t10-ej5 --- .../assignments/t10-ej5-shell-naortega/part1.sh | 15 +++++++++++++++ .../assignments/t10-ej5-shell-naortega/part2.sh | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 1/ISO/assignments/t10-ej5-shell-naortega/part1.sh create mode 100755 1/ISO/assignments/t10-ej5-shell-naortega/part2.sh diff --git a/1/ISO/assignments/t10-ej5-shell-naortega/part1.sh b/1/ISO/assignments/t10-ej5-shell-naortega/part1.sh new file mode 100755 index 0000000..3b336a8 --- /dev/null +++ b/1/ISO/assignments/t10-ej5-shell-naortega/part1.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +mkdir /home/user/ +mkdir -p /home/user/{dir1/dir11, dir2/dir21, dir3/dir31, dir4} +touch /home/user/dir2/dir21/notas.txt +mv /home/user/dir2/dir21/notas.txt /home/user/dir4/ +cp /home/user/dir4/notas.txt /home/user/dir3/dir31/ +# asumo que es crear el archivo ligadefamosos.doc en dir31 +touch /home/user/dir3/dir31/ligadefamosos.doc +chmod 700 /home/user/dir3/dir31/ligadefamosos.doc +chmod u+rwx,go-rwx /home/user/dir3/dir31/ligadefamosos.doc +chmod 777 /home/user/dir3/dir31/ligadefamosos.doc +chmod a+rwx /home/user/dir3/dir31/ligadefamosos.doc +chmod 500 /home/user/dir3/dir31/ligadefamosos.doc +chmod u+rx-w go-rwx /home/user/dir3/dir31/ligadefamosos.doc diff --git a/1/ISO/assignments/t10-ej5-shell-naortega/part2.sh b/1/ISO/assignments/t10-ej5-shell-naortega/part2.sh new file mode 100755 index 0000000..15ba360 --- /dev/null +++ b/1/ISO/assignments/t10-ej5-shell-naortega/part2.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ $# -lt 5 ] +then + echo "Mínimo de 5 parámetros. Has introducido tan sólo $#." + exit 1 +fi + +echo "Se han introducido $# parámetros." +echo "Los primeros tres son los siguientes:" + +# el primer parámetro es el programa en sí, así que empezamos por 1 +for i in ${@:1:3} +do + echo $i +done