Yurttas/PL/SL/ruby/F/03/02/e 00.rb

From ZCubes Wiki
Jump to navigation Jump to search
 1#
 2#  Copyright(C) 2008
 3#  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4#
 5#  Permission to use, copy, modify, and distribute this
 6#  software and its documentation for EDUCATIONAL purposes
 7#  and without fee is hereby granted provided that this
 8#  copyright notice appears in all copies.
 9#
10#  date   : June 1, 2008.
11#  author : Salih Yurttas. Jackson Booth.
12#
13#  e_00.rb
14#
15
16puts "In parent, term = #{ENV['TERM']}"
17
18fork do
19  puts "Start of child 1, term = #{ENV['TERM']}"
20  ENV['TERM'] = "ansi"
21
22  fork do
23    puts "Start of child 2, term = #{ENV['TERM']}"
24  end
25
26  Process.wait
27
28  puts "End of child 1, term = #{ENV['TERM']}"
29end
30
31Process.wait
32
33puts "Back in parent, term = #{ENV['TERM']}"