CONSUMER ADVISORY: if the UNIX commands ls, rm, mkdir, or pwd are not in the
directory /usr/bin, then you will need to change
the code in ~/idlpro/unixcommands.pro.
The IDL prompt should reflect the current working directory (however, in
the following examples, I'll use IDLprompt> to
indicate the command line prompt in IDL). To change the current IDL
directory, use the following command:
IDLprompt> c, 'newdir'
where newdir is the pathname of the new
directory, relative to the current directory. The single quotes
ARE necessary. If you use cd
instead of c, it will change the directory, but
it won't update the prompt. If this ever happens, do this:
IDLprompt> c, /u
and this should update the prompt.
The UNIX commands "ls" and "pwd" work in IDL:
IDLprompt> pwd
will print the present working directory, and
IDLprompt> ls
will give a listing of the current directory. If you want to run ls with any arguments, eg., ls -l
  lowerdir/testfile.txt to give a verbose listing of a file
called testfile.txt in the relative directory
lowerdir, do the following:
IDLprompt> ls, '-l lowerdir/testfile.txt'
Just enclose in single quotes (after a comma) anything that would follow
ls on the UNIX command line. The same goes for
mkdir:
IDLprompt> mkdir, 'arguments'
There's also an rm command.
Warning: the default is to run rm with the -f switch, which
deletes files without asking you first, and this will be the default
behavior EVEN IF you've aliased ls to ls -i (which deletes
interactively). Fortunately, however, -i
overrides -f. So, for example, to interactively
remove all the files in the current IDL directory:
IDLprompt> rm, '-i *'
And to remove the file lamefile.txt without
asking:
IDLprompt> rm, 'lamefile.txt'
Program level
IDL has something called the program level, and it's an indication of where
you are -- to what variables you have access, for example. When IDL
starts, it's at the MAIN program level. If an IDL program
crashes, the program level goes to the level of that program, and the
interpretter is halted at the line of source code where the crash occurred.
The local variables are the variables defined in that program, and
variables in other levels (eg., MAIN) are not accessable.
If a program crashes and you need to return to the main level, use the
retall command: