128 lines
2.6 KiB
Makefile
128 lines
2.6 KiB
Makefile
|
|
|
||
|
|
#
|
||
|
|
# Copyright (c) 2021 Guy Baconniere.
|
||
|
|
#
|
||
|
|
## How to use this Makefile
|
||
|
|
#
|
||
|
|
# cd git
|
||
|
|
# mkdir ex00
|
||
|
|
# cd ex00
|
||
|
|
# make -f ../../Makefile ex00
|
||
|
|
#
|
||
|
|
|
||
|
|
hash = \#
|
||
|
|
|
||
|
|
clone:
|
||
|
|
@git clone git@vogsphere.42lausanne.ch:vogsphere/intra-uuid-6ab96e6e-8d3c-4e8c-98b0-b13b474817ad-3700999 git
|
||
|
|
|
||
|
|
tarball:
|
||
|
|
@install -d -m 0750 resources
|
||
|
|
@tar -C resources -xvf resources.tar.gz
|
||
|
|
|
||
|
|
ex00:
|
||
|
|
@rm -f z
|
||
|
|
@echo Z > z
|
||
|
|
@cat z
|
||
|
|
|
||
|
|
ex01:
|
||
|
|
@rm -f testShell00.tar
|
||
|
|
@perl -e 'print "42"x20' > testShell00
|
||
|
|
@touch -t 2106012342.00 testShell00
|
||
|
|
@chmod 0455 testShell00
|
||
|
|
@ls -l
|
||
|
|
@tar -cf testShell00.tar testShell00
|
||
|
|
@rm -f testShell00
|
||
|
|
|
||
|
|
ex02:
|
||
|
|
@rm -fr test? exo2.tar
|
||
|
|
@mkdir test0
|
||
|
|
@mkdir test2
|
||
|
|
@printf "4242" > test1
|
||
|
|
@printf "4" > test3
|
||
|
|
@printf "42" > test4
|
||
|
|
@touch -t 2106012047.00 test0
|
||
|
|
@touch -t 2106012146.00 test1
|
||
|
|
@touch -t 2106012245.00 test2
|
||
|
|
@touch -t 2106012344.00 test3
|
||
|
|
@touch -t 2106012343.00 test4
|
||
|
|
@ln test3 test5
|
||
|
|
@ln -s test0 test6
|
||
|
|
@touch -h -t 2106012220.00 test6
|
||
|
|
@chmod 0715 test0
|
||
|
|
@chmod 0714 test1
|
||
|
|
@chmod 0504 test2
|
||
|
|
@chmod 0404 test3
|
||
|
|
@chmod 0641 test4
|
||
|
|
@chmod 0404 test5
|
||
|
|
@chmod -h 0755 test6
|
||
|
|
@ls -l
|
||
|
|
@tar -cf exo2.tar *
|
||
|
|
@rm -fr test?
|
||
|
|
|
||
|
|
ex03:
|
||
|
|
@rm -f klist.txt
|
||
|
|
@klist -t || kinit -f -l 10h gbaconni@42LAUSANNE.CH
|
||
|
|
@klist > klist.txt
|
||
|
|
@cat klist.txt
|
||
|
|
|
||
|
|
ex04:
|
||
|
|
@rm -fr midLS test?
|
||
|
|
@mkdir test0
|
||
|
|
@touch -r /usr/bin/topsyscall test1
|
||
|
|
@touch -r /bin/sh test2
|
||
|
|
@touch test3
|
||
|
|
@printf "#!/bin/sh\n" > midLS
|
||
|
|
@printf "ls -mptU\n" >> midLS
|
||
|
|
@chmod +x midLS
|
||
|
|
@./midLS
|
||
|
|
@rm -fr midLS test?
|
||
|
|
@printf "ls -mptU\n" > midLS
|
||
|
|
|
||
|
|
ex05:
|
||
|
|
@rm -fr git_commit.sh
|
||
|
|
@printf "#!/bin/sh\n" > git_commit.sh
|
||
|
|
@printf "git log --pretty='%%H' --max-count=5\n" >> git_commit.sh
|
||
|
|
@chmod +x git_commit.sh
|
||
|
|
@bash git_commit.sh | cat -e
|
||
|
|
|
||
|
|
ex06:
|
||
|
|
@rm -fr git_ignore.sh .DS_Store mywork.c~
|
||
|
|
@touch .DS_Store mywork.c~
|
||
|
|
@printf "#!/bin/sh\n" > git_ignore.sh
|
||
|
|
@printf "git ls-files --exclude-standard --ignored --others\n" >> git_ignore.sh
|
||
|
|
@chmod +x git_ignore.sh
|
||
|
|
@cd .. && bash ex06/git_ignore.sh | cat -e
|
||
|
|
@rm -fr .DS_Store mywork.c~
|
||
|
|
|
||
|
|
ex07:
|
||
|
|
@cp ../../resources/* .
|
||
|
|
@cp a b
|
||
|
|
@echo "Enter b"
|
||
|
|
@patch < sw.diff
|
||
|
|
@rm -f a sw.diff
|
||
|
|
|
||
|
|
ex08:
|
||
|
|
@rm -f clean test? ?test
|
||
|
|
@touch -r /bin/sh "test$(hash)"
|
||
|
|
@touch "$(hash)test"
|
||
|
|
@touch "test~"
|
||
|
|
@touch "test0"
|
||
|
|
@printf "#!/bin/sh\n" > clean
|
||
|
|
@printf "find . -type f \( -name '*~' -o -name '#*#' \) -print -delete\n" >> clean
|
||
|
|
@chmod +x clean
|
||
|
|
@./clean
|
||
|
|
@ls -l
|
||
|
|
@rm -f clean test? ?test
|
||
|
|
@printf "find . -type f \( -name '*~' -o -name '#*#' \) -print -delete\n" >> clean
|
||
|
|
|
||
|
|
ex09:
|
||
|
|
@rm -f ft_magic test?
|
||
|
|
@touch -r /bin/sh "test0"
|
||
|
|
@perl -e 'print "\0"x41 . "42"' > "test1"
|
||
|
|
@printf "41\tstring\t42\t42 file\n" > ft_magic
|
||
|
|
@file -m ft_magic *
|
||
|
|
@rm -f test?
|
||
|
|
|
||
|
|
all: clone
|
||
|
|
|