Sponsored Content
Full Discussion: Cd
Top Forums UNIX for Dummies Questions & Answers Cd Post 7944 by Neo on Wednesday 3rd of October 2001 09:00:54 PM
Old 10-03-2001
Perhaps it would help if we looked at /usr/bin/cd, not from the context of listing files in a directory in an interactive shell, but for a command sequence:

NOTE: MAY NOT WORK.... TRY WITH EXTREME CAUTION !!!

/usr/bin/cd /tmp; rm -rf *

NOTE: MAY NOT WORK.... TRY WITH EXTREME CAUTION !!!

This would appear, if I'm not mistaken, to spawn a child process that would remove all the files in the /tmp directory. After that task completes and the child process exists; the original shell process and current directory would be the same as before the command sequence was executed.

Another example might be as simple as:

/usr/bin/cd /usr/spool/mail; ls -la > /tmp/mail_stuff

One could argue that the sequence:

ls -la /usr/spool/mail > /tmp/mail_stuff

would accomplish the same thing.... agreed.

However, it seems that there are numerous possible scenarios where /usr/bin/cd could be useful when used in a command line sequence and subshell
 
create child(1m)														  create child(1m)

NAME
create child - Creates a child pointer at the master replica of the parent directory SYNOPSIS
cdscp create child child-name clearinghouse clearinghouse-name ARGUMENTS
The full name of the child pointer. The full name of a clearinghouse that contains a replica of the child directory. DESCRIPTION
The create child command creates a child pointer at the master replica of the parent directory. When CDS looks up a name in the namespace, it uses child pointers to locate directory replicas. Use the set cdscp preferred clearinghouse command before issuing this command to ensure that the request is directed to the master replica. Privilege Required You must have insert permission to the parent directory. NOTES
Use the create child command only to re-create a child pointer that is accidentally deleted. This command is designed only for trou- bleshooting. This command will fail if the associated directory does not exist. If the associated directory exists, this command will return success- fully. This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE. EXAMPLE
The following command creates the child pointer in the parent directory /.:/subsys. It uses the replica located at the /.:/subsys/NY_CH clearinghouse to fill in its replica set. cdscp> create child /.:/subsys clearinghouse /.:/subsys/NY_CH RELATED INFORMATION
Commands: delete child(1m), list child(1m), show child(1m) create child(1m)
All times are GMT -4. The time now is 06:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy