06-10-2002
When you execute the script, it starts a child process. The child process ends up in the last directory - not the parent.
To have the parent end up there, you need to run the script differently
sh and ksh
% . ./myscript
csh
$ source ./myscript
This will cause the parent to run the script instead of creating a child process to do it. Beware that some other problems may be created by doing this (just check that your script is not expecting something from the directory you started in...)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
Iam in directory A. I run a script from there. inside the script i have a command cd B.
When i come out of the script directory is A only.
Even when i come out scrip i want the directory to be B
How to achieve (2 Replies)
Discussion started by: mkan
2 Replies
2. UNIX for Dummies Questions & Answers
I have a directory that is existing under my root dir of the FTP server. The DIR name is 'Software Patch'. I want to move in to that DIR to download some patches. But, when I issued a command 'cd SOftware Patch', the system said that it cannot find the dir 'Software'. I tried all possible ways like... (2 Replies)
Discussion started by: vskr72
2 Replies
3. UNIX for Dummies Questions & Answers
Hi I have abc_ahb_one.v
abc_ahb_two.v
abc_ahb_three.v
........l
like this
-----upto
abc_ahb_ninety.v in some directory.
I need to change those file names to like below.
... (5 Replies)
Discussion started by: praneethk
5 Replies
4. Shell Programming and Scripting
I have a simple shell script that prompts the user to enter a directory to navigate to.
What i want it to do and i don't know how to do this is if the directory is invalid automatically navigate to the home directory.
echo "enter a directory to navigate to:"
read directory
cd $directory... (6 Replies)
Discussion started by: icelated
6 Replies
5. AIX
Dear all expects,
I have a security problem that I would like to resolve.
I need to create a user ID in my AIX 5.3 environment and to point the login to a specific directory for FTP purposes. There is only 2 directories that I can allow the user ID to perform read/write. I would like to prevent... (2 Replies)
Discussion started by: kwliew999
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I Installed mysql on my CentOS 6.2 Server. But when I tried to change the location of /var/lib/mysql to another directory. I can't start the mysql. Below is what I've done
yum install mysql mysql-server mysql-devel
mkdir /path/to/new/
cp -R /var/lib/mysql /path/to/new
chown -R... (1 Reply)
Discussion started by: ganitolngyundre
1 Replies
7. Shell Programming and Scripting
I am trying to do the following task :
export ENV=aaa
export ENV_PATH=$(cd /apps | ls | grep $ENV)
However, it's not working. What's the way to change to directory and search some file in that directory in single command
Please help. (2 Replies)
Discussion started by: saurau
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
How do i change the permission to read/write to a windows directory? (1 Reply)
Discussion started by: lg123
1 Replies
9. Shell Programming and Scripting
Hi All,
There is a code like below in my script
###############################################
###Create Directories and Sub-Directories
###############################################
dpdir=DP_FROM_${from}_TO_${to}
mkdir $dpdir
cd $dpdir
mkdir AWQM WFCONTROLLER PROVCO PRISM
... (1 Reply)
Discussion started by: pvmanikandan
1 Replies
10. Shell Programming and Scripting
#!/bin/bash
echo -n "Enter number of sanger patients : "; read id
perl -ne 'chomp; system ("perl table_annovar.pl $_ humandb/ -buildver hg19 -protocol refGene,popfreq_all,common,clinvar,clinvarsubmit,clinvarreference -operation g,f,f,f,f,f -otherinfo")' < file.txt
I have the above script... (7 Replies)
Discussion started by: cmccabe
7 Replies
fork(2) System Calls Manual fork(2)
Name
fork - create a new process
Syntax
#include <sys/types.h>
#include <unistd.h>
pid = fork()
pid_t pid;
Description
The system call causes creation of a new process. The new process (child process) is an exact copy of the calling process except for the
following:
o The child process has a unique process ID.
o The child process has a different parent process ID (that is, the process ID of the parent process).
o The child process has its own copy of the parent's descriptors. These descriptors reference the same underlying objects, so that, for
instance, file pointers in file objects are shared between the child and the parent, so that a on a descriptor in the child process
can affect a subsequent read or write by the parent. This descriptor copying is also used by the shell to establish standard input
and output for newly created processes as well as to set up pipes.
o The child processes resource utilizations are set to 0. For further information, see
Return Values
Upon successful completion, returns a value of 0 to the child process and returns the process ID of the child process to the parent
process. Otherwise, a value of -1 is returned to the parent process, no child process is created, and the global variable errno is set to
indicate the error.
Diagnostics
The system call fails and no child process are created under the following conditions:
[EAGAIN] The system-imposed limit {PROC_MAX} on the total number of processes under execution would be exceeded.
[EAGAIN] The system-imposed limit {CHILD_MAX} on the total number of processes under execution by a single user would be exceeded.
[ENOMEM] There is insufficient swap space for the new process.
See Also
execve(2), wait(2)
fork(2)