From: Robert Klemme Date: 2006-08-10T19:05:11+09:00 Subject: Re: access built-in shell commands like 'history' or 'fc' On 09.08.2006 21:51, bwv549 wrote: >> Could it be that Ruby is using a different shell than you are used to? >> I think it uses /bin/sh by default (not sure). > > Perhaps that is part of it. However, on this suggestion, I entered the > suggested shell (/bin/sh). However, the behavior hasn't changed, > although the 'history' command works fine in this shell. > > Just for reference, this is what I get when checking what this shell > is: > > % /bin/sh --version > GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu) > Copyright (C) 2005 Free Software Foundation, Inc. > > I'm on Ubuntu 6.X, just for reference. There is really no point in accessing the history of the shell because what you likely want is the history of the *invoking* shell, i.e. the one that started your ruby interpreter. AFAIK there is no way to access that history. If you want to work with that you can do this at the shell prompt. history | ruby -e '...' Your example with "pwd" worked because "pwd" is also an external program (try it out with "type -a pwd"). But you can access PWD much easier from inside Ruby: 12:03:59 [~]: ruby -e 'puts Dir.pwd, ENV["PWD"]' /cygdrive/w /cygdrive/w Kind regards robert