home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / unix / unixcmds_1 / BIN / popd < prev    next >
Encoding:
Text File  |  1993-06-10  |  399 b   |  22 lines

  1. # vi:si:ts=4:sw=4
  2. # Implements popd using a system Variable (DIRSTACK) to store the stack.
  3.  
  4. die "Usage: popd\n" unless ($#ARGV == -1);
  5.  
  6. @dirs = split(' ', $ENV{"DIRSTACK"});
  7. die "Directory stack empty\n" unless ($#dirs >= 0);
  8.  
  9. $_ = shift(@dirs);
  10. system("%dir $_");
  11.  
  12. $dirs = join(' ', @dirs);
  13. $dirs =~ s/</|</g;
  14. if ($dirs eq "")
  15. {
  16.     system("Unset DIRSTACK");
  17. }
  18. else
  19. {
  20.     system("Set DIRSTACK $dirs");
  21. }
  22.