回答編集履歴
2
追記
answer
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
`/tmp/parent.sh`で以下のようにすると`01-child.sh`の`pwd`で`/tmp/children`を得られます。
|
8
8
|
```bash
|
9
|
+
# ↓に変更 ./children/01-child.sh
|
9
10
|
(cd ./children ; ./01-child.sh)
|
10
11
|
```
|
11
12
|
|
1
誤記修正
answer
CHANGED
@@ -15,15 +15,15 @@
|
|
15
15
|
root:/tmp/$ tree
|
16
16
|
.
|
17
17
|
├── children
|
18
|
-
│ └──
|
18
|
+
│ └── 01-child.sh
|
19
19
|
└── parent.sh
|
20
20
|
|
21
21
|
1 directory, 2 files
|
22
22
|
root:/tmp/$ cat parent.sh
|
23
23
|
#!/bin/bash
|
24
|
-
./children/
|
24
|
+
./children/01-child.sh
|
25
25
|
|
26
|
-
root:/tmp/$ cat children/
|
26
|
+
root:/tmp/$ cat children/01-child.sh
|
27
27
|
#!/bin/bash
|
28
28
|
childpath=$(cd $(dirname $0); pwd)
|
29
29
|
echo "$childpath"
|