   send -s "sudo su -\r"
   exp_continue
 } "*# " {
-  if { $app == "nsm" } {
-    send -s "unset TMOUT;ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime;ntpdate -u 172.30.73.133;hwclock --systohc\r"
+  send "echo \${SHELL}\r"
+}
+
+expect "*#" {
+  if { ! [regexp "bash" $expect_out(buffer)] } {
+    send -s "bash\r"
   } else {
     send "\r"
   }
 }
 
+expect "*#" {
+  send -s "uname\r"
+}
+
+expect "*#" {
+  if { [regexp "Linux" $expect_out(buffer)] } {
+    set os "Linux"
+  } elseif { [regexp "SunOS" $expect_out(buffer)] } {
+    set os "SunOS"
+  } else {
+    return
+  }
+  send "\r"
+}
+
+expect "*#" {
+  if { $os == "Linux" } {
+    if { $app == "nsm" } {
+      send -s "unset TMOUT;ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime;ntpdate -u 172.30.73.133;hwclock --systohc\r"
+    }
+  } elseif { $os eq "SunOS" } {
+    send "ntpdate -u 172.30.73.133\r"
+  } else {
+    send "\r"
+  }
+}
+
+
 if { $app == "nsm" } {
   expect "*#" {
-    send "ifconfig | perl -nle'/dr:(172.30.\\S+)/&&print\$1'\r"
+    if { $os == "Linux" } {
+      send -s "ifconfig | perl -nle'/dr:(172.30.\\S+)/&&print\$1'\r"
+    } elseif { $os == "SunOS" } {
+      send -s "ifconfig -a | perl -nle'/net (172.30.\\S+)/&&print\$1'\r"
+    }
   }
 
   expect "*#" {

      if { $app == "nsm" } { 
        expect timeout {
          set timeout 60
        } "*$ " { 
          send "exit\r" 
          sleep 1

}

expect "*# " {
  log_file "$logdir/$host-$filetime.log"
  send_log "\n---------- log start at $time ----------\n"
  send_user "\n---------- session start at $time ----------\n"

