04/28/88 change_wdir, cwd Syntax as a command: cwd {PATH} {-control_args} Function: changes your working directory to the directory specified by the PATH optional argument. If PATH is omitted and neither -pop nor -rotate is specified, changes to the default working directory. Several features help in moving among a group of directories. When changing to another working directory, the current directory can be remembered by pushing onto a stack. Directories on the stack can be revisited by giving their location within the stack, rather than their pathname. Stack locations are identified either by an integer position from the top of the stack, or by a name (label) associated with the stack entry when it was remembered. The most recently pushed working directory is at the top of the stack (position 1). Directories pushed earlier appear lower in the stack. The -push operation allows you to remember the current working directory when you plan to move back to it again. Additionally, -push with an optional LABEL argument allows you to attach a text string LABEL to the current working directory being pushed onto a stack to aid in moving back to that labelled working directory. The -pop operation allows you to move back to a particular directory without naming the directory and additionally removes from the stack all working directories immediately above it. The -rotate operation is similar to -pop, moves to a stack entry identified by the stack LOCATION, but it doesn't remove any working directory from the stack while -pop does. The -clear operation allows you to remove working directories from the stack without changing the current working directory. There are some restrictions applied to the LABEL. See "Notes" for more details. The PATH optional argument is mutually exclusive with -pop and -rotate. -clear, -pop, -push and -rotate are also mutually exclusive. Arguments: PATH is the pathname of the new working directory. If PATH is omitted and neither -pop nor -rotate is specified, the default working directory becomes the current working directory. PATH cannot be used when -pop or -rotate is specified. -clear {LOCATION}, -cl {LOCATION} remove working directories from the stack without changing the current working directory. -clear must be the last control argument on the command line. LOCATION can be an integer position N from the top of the stack; or a text LABEL associated with a stack entry; or one of the reserved words first (f), last (l) or all (a). The reserved word first identifies the top stack directory (stack position 1); last identifies the bottom stack entry; and all identifies all stacked directories. More than one LOCATION can be given to select several entries. Individual locations are separated by a space. A LOCATION_RANGE is given by a starting and ending LOCATION separated by a colon. For example, f:2 identifies the top two directories on the stack, and 1:XXX identifies stack entries from the top of the stack to the entry with label XXX. If no LOCATION are given, the entire stack is cleared. This operation cannot be used when -pop, -push, or -rotate are specified. -pop {LOCATION} pop to the working directory identified by the stack LOCATION. LOCATION is the position number N from the top of the working directory stack or the text string LABEL associated with a stack entry. The directory popped to becomes the new working directory. Directories above the selected directory are removed (popped) from the stack. Directories below the selected directory remain on the stack. If LOCATION is omitted, the position number 1 within stack is assumed. This operation cannot be used when PATH, -clear, -push, or -rotate are specified. -push {LABEL} push the current working directory onto the stack for later reference. If LABEL is specified, it becomes a name attached to the stack entry of the current working directory. See "Notes" for further information. This operation cannot be used when -clear, -pop, or -rotate are specified. -rotate {LOCATION {LABEL}} move to the working directory identified by the stack LOCATION. LOCATION is the position number N from the top of the working directory stack or the text string LABEL associated with a stack entry. If LABEL argument is specified, this name is associated by the stack entry of the current working directory. Rotation occurs by placing the current working directory at the bottom of the stack, and setting the current working directory from the top stack entry. If LOCATION is a position number N, then the rotation operation occurs N times until the Nth stack entry becomes the current working directory. If LOCATION is a stack label, the rotation operation occurs until the labelled stack entry becomes the current working directory. If LOCATION is omitted, a position of 1 is assumed. This operation cannot be used when PATH, -clear, -pop, or -push are specified. Notes: Status access mode is required on the directory PATH. LABEL is a text string which identifies a stack entry. Its maximum length is 32 characters. It cannot begin with a minus sign (-) or a numeric digit, and cannot include a colon (:). The words "first", "f", "last", "l", "all", and "a" are reserved words which cannot be used as LABEL names. Also see the print_wdir and working_dir commands/active functions. Examples: In the following examples, the current working directory is shown above stack position 1. Assume that the current working directory is ">udd>m>tai" 1. An attempt to use a push function without LABEL. For example: ! cwd cwd_dev -push pushes the >udd>m>tai current working directory onto the stack of prior working directories and changes to the >udd>m>tai>cwd_dev new current working directory. ! pwd a LOC LABEL PATHNAME 0 >udd>m>tai>cwd_dev 1 >udd>m>tai 2. An attempt to use a push function with LABEL. For example: ! cwd udd>m>tai>abbrev_dev 1 XXX >udd>m>tai>cwd_dev 2 >udd>m>tai 3. Then attempt to use a pop function. For example: ! cwd -pop XXX ! pwd a LOC LABEL PATHNAME 0 XXX >udd>m>tai>cwd_dev 1 >udd>m>tai ! cwd <udd>m>barmar 1 YYY >udd>m>tai>cwd_dev 2 >udd>m>tai 4. An attempt to use a rotate function: Assume that the stack contents look like: 0 YYY >udd>m>tai>archive_dev 1 >udd>m>tai>abbrev_dev 2 XXX >udd>m>tai>cwd_dev 3 >udd>m>tai ! cwd -rotate XXX ZZZ labels the >udd>m>tai>archive_dev current working directory to ZZZ and rotates the stack until the top-most labelled directory is at the top of the stack. ! pwd a LOC LABEL PATHNAME 0 XXX >udd>m>tai>cwd_dev 1 >udd>m>tai 2 ZZZ >udd>m>tai>archive_dev 3 >udd>m>tai>abbrev_dev ! cwd -rotate 2 ! pwd a LOC LABEL PATHNAME 0 ZZZ >udd>m>tai>archive_dev 1 >udd>m>tai>abbrev_dev 2 XXX >udd>m>tai>cwd_dev 3 >udd>m>tai 4. An attempt to use only PATH. For example: ! cwd udd>m>tai>test_dir 1 >udd>m>tai>abbrev_dev 2 XXX >udd>m>tai>cwd_dev 3 >udd>m>tai 5. An attempt to use a clear function. The stack contents show as belows. For example: 0 >udd>m>tai>abbrev_dev 1 XXX >udd>m>cwd_dev 2 YYY >udd>m>barmar 3 XXX >udd>m>tai ! cwd -clear XXX ! pwd a LOC LABEL PATHNAME 0 >udd>m>tai>abbrev_dev 1 YYY >udd>m>barmar 2 XXX >udd>m>tai ! cwd -clear a ! pwd a 0 >udd>m>tai>abbrev_dev 6. Assume that a directory named >udd>m>gd exists. ! cwd <udd>m>gd ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved