回答編集履歴

4

変更

2017/07/26 02:06

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  #!/usr/bin/perl
32
32
 
33
- system("/test1.pl 引数1");
33
+ my $msg=system("/test1.pl 引数1");
34
34
 
35
35
  if ($? == -1) {
36
36
 
@@ -44,4 +44,6 @@
44
44
 
45
45
  }
46
46
 
47
+ print $msg ."\n";
48
+
47
49
  ```

3

追加

2017/07/26 02:06

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
@@ -21,3 +21,27 @@
21
21
  echo $?
22
22
 
23
23
  ```
24
+
25
+
26
+
27
+ 外部プロセスの終了ステータスは$?という特殊変数の上位8bitの中に入っいるそうです。
28
+
29
+ ```
30
+
31
+ #!/usr/bin/perl
32
+
33
+ system("/test1.pl 引数1");
34
+
35
+ if ($? == -1) {
36
+
37
+ die "failed to execution: $!\n";
38
+
39
+ }else{
40
+
41
+ $rc = $? >> 8;
42
+
43
+ print $rc ."\n";
44
+
45
+ }
46
+
47
+ ```

2

変更

2017/07/18 07:30

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
@@ -1,4 +1,4 @@
1
- systemから呼べるならbashから呼んで戻り値を得るのはどうでしょうか?
1
+ systemから呼べるならbashから呼んで戻り値を得るのはどうでしょうか?
2
2
 
3
3
  ```sh
4
4
 

1

変更

2017/07/18 06:42

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  #!/bin/sh
18
18
 
19
- perl /test1.pl 引数1
19
+ /usr/bin/perl /test1.pl 引数1
20
20
 
21
21
  echo $?
22
22