teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2021/03/02 13:56

投稿

Y.H.
Y.H.

スコア7918

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

誤記修正

2021/03/02 13:56

投稿

Y.H.
Y.H.

スコア7918

answer CHANGED
@@ -15,15 +15,15 @@
15
15
  root:/tmp/$ tree
16
16
  .
17
17
  ├── children
18
- │   └── children.sh
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/children.sh
24
+ ./children/01-child.sh
25
25
 
26
- root:/tmp/$ cat children/children.sh
26
+ root:/tmp/$ cat children/01-child.sh
27
27
  #!/bin/bash
28
28
  childpath=$(cd $(dirname $0); pwd)
29
29
  echo "$childpath"