Shell Tools and Scripting课后练习
1
2
3
4
5
6
7
8
9
10
11rust@DESKTOP-L4PLVQ4:~/missing$ ls -lhat --color
total 0
-rw-r--r-- 1 rust rust 7 Mar 27 16:18 foo1
drwxr-xr-x 1 rust rust 4.0K Mar 26 22:01 ..
drwxr-xr-x 1 rust rust 4.0K Mar 26 18:55 .
-rwxrwxrwx 1 rust rust 83 Mar 26 18:55 script.py
drwxr-xr-x 1 rust rust 4.0K Mar 26 18:19 bar
drwxr-xr-x 1 rust rust 4.0K Mar 26 18:19 foo
-rw-r--r-- 1 rust rust 0 Mar 26 18:11 foo10
-rw-r--r-- 1 rust rust 0 Mar 26 18:11 foo2
drwxr-xr-x 1 rust rust 4.0K Mar 26 17:14 b
1
2
3
4
5
6
7
8marco.sh
!/bin/bash
marco() {
export MARCO=$(pwd)
}
polo() {
cd "$MARCO"
}
1 | rust@DESKTOP-L4PLVQ4:~/missing/test$ source marco.sh |
1
2
3
4
5
6
7
8
9
10
11
12
13
14count=1
while true
do
./buggy.sh 2> out.log
if [[ $? -ne 0 ]]; then
echo "failed after $count times"
cat out.log
break
fi
((count++))
done