開発環境
- OS X Lion - Apple(OS)
- TextWrangler(Text Editor) (BBEditの機能制限無料版、light版)
- Script言語:Perl
『初めてのPerl 第6版』(Randal L. Schwartz, Tom Phoenix, brian d foy 共著、近藤 嘉雪 訳、オライリー・ジャパン、2012年、ISBN978-4-87311-567-2) の16章(プロセス管理)、16.9(練習問題)1を解いてみる。
その他参考書籍
1.
コード(TextWrangler)
sample.pl
#!/usr/bin/env perl use strict; use warnings; use utf8; use 5.012; binmode STDOUT, ':utf8'; binmode STDIN, ':utf8'; chdir "/" or die "can't chdir to /: $!"; exec 'ls', '-l' or die "can't exec ls: $!";
入出力結果(Terminal)
$ ./sample.pl total 30461 drwxrwxr-x+ 62 root admin 2108 10 5 14:52 Applications drwxrwxr-x@ 19 root admin 646 8 6 2011 Developer-3.2.6 drwxr-xr-x+ 68 root wheel 2312 4 23 23:20 Library drwxr-xr-x@ 2 root wheel 68 8 17 2011 Network drwxr-xr-x+ 4 root wheel 136 9 20 08:39 System drwxr-xr-x 5 root admin 170 10 16 2011 Users drwxrwxrwt@ 5 root admin 170 10 8 00:18 Volumes drwxr-xr-x@ 39 root wheel 1326 9 20 08:31 bin drwxrwxr-t@ 2 root admin 68 8 17 2011 cores dr-xr-xr-x 3 root wheel 4215 10 5 14:36 dev lrwxr-xr-x@ 1 root wheel 11 10 16 2011 etc -> private/etc dr-xr-xr-x 2 root wheel 1 10 7 17:03 home drwxrwxrwt 3 root wheel 102 7 1 22:10 lost+found -rw-r--r--@ 1 root wheel 15572704 8 24 08:27 mach_kernel dr-xr-xr-x 2 root wheel 1 10 7 17:03 net drwxr-xr-x 3 root admin 102 9 5 2011 opt drwxr-xr-x@ 6 root wheel 204 10 16 2011 private drwxr-xr-x@ 62 root wheel 2108 9 20 08:31 sbin lrwxr-xr-x@ 1 root wheel 11 10 16 2011 tmp -> private/tmp drwxr-xr-x@ 15 root wheel 510 5 10 10:20 usr lrwxr-xr-x@ 1 root wheel 11 10 16 2011 var -> private/var lrwxr-xr-x 1 root admin 60 3 23 2010 ユーザーズガイドと情報 -> /Library/Documentation/User Guides and Information.localized $
0 コメント:
コメントを投稿