: Hi Iam writing a shell who are going to work under UNIX. I have come so
: far that I now wcan list directories.
Does this mean you've already solved the problem in your post "Make prompt" for yourself?
: What should I write so that the shell starts from my homefolder?? like
: C:\.. ??
You can often find information like this in the environment data (in %ENV). Run this script from the command line:-
print "$_=$ENV{$_}\n" for sort keys %ENV;
To see what you get. Entries of obvious interest:-
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Jonathan
USERPROFILE=C:\Documents and Settings\Jonathan
You'd get at these, for example, by using $ENV{'USERPROFILE'}. So to change to that directory you'd do:-
chdir $ENV{'USERPROFILE'};
In your script. Note that this is a bit Win32 specific. But the home directroy on a Linux/UNIX box will generally also be in the environment variables (as just HOME, usually). You can check the OS by looking at the $^O variable - it equals 'MSWin32' under Windows.
: Another question...Whatr shhould I write to execute a program..
:
Depends. Look up the system and exec (maybe used in conjunction with fork) functions. Backticks are also useful if you want to capture the output of a program.
my $pingresp = `ping 127.0.0.1`;
Jonathan
###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");