本文最后更新于:2023年9月30日 凌晨
计算机教育中缺失的一课-作业
第一天-课程概览与 shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| echo $SHELL
mkdir /tmp/missing
man touch
cd /tmp/missing touch semester
echo '#!/bin/sh' > semester echo curl --head --silent https://missing.csail.mit.edu >> semester
chmod +x semester ./semester
HTTP/2 200 server: GitHub.com content-type: text/html; charset=utf-8 last-modified: Sat, 10 Jun 2023 13:13:30 GMT access-control-allow-origin: * etag: "648476fa-1f86" expires: Fri, 30 Jun 2023 09:10:55 GMT cache-control: max-age=600 x-proxy-cache: MISS x-github-request-id: 68D8:0DEE:7363C9:78E07A:649E99C7 accept-ranges: bytes date: Mon, 03 Jul 2023 16:01:06 GMT via: 1.1 varnish age: 0 x-served-by: cache-tyo11941-TYO x-cache: HIT x-cache-hits: 1 x-timer: S1688400067.585549,VS0,VE165 vary: Accept-Encoding x-fastly-request-id: 41d45d32ac886ab559092a38d7c33736620c2d23 content-length: 8070
./semester | sed -n "4,4p" | cut -d ' ' -f 2- > last-modified.txt cat last-modified.txt
云服务器,做不了
|
第二天-Shell 工具和脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
ls -al
ls -al --block-size=M
ls -lt
ls -l --color=auto
marco () { lastdir=$(pwd) echo $lastdir } polo () { cd $lastdir }
echo "Start to find magic number..." rm stdout.log stderr.log while true do bash cnterror.sh >> stdout.log 2> stderr.log if [ -s stderr.log ]; then break fi done echo "stderr is:" cat stderr.log echo "stdout is:" cat stdout.log runtimes=$(grep -o "Everything" stdout.log | wc -l) echo "The cnterror.sh runs $runtimes times"
find . -type f -name "*.html" | xargs -d '\n' tar -czf somehtmls.tar.gz
find . -type f | xargs ls -lta
|
第三天-编辑器 (Vim)
发现网站自带答案,到这里我就不做记录啦,偶尔抽空学一下,虽然一部分已经学过了,温故知新!