10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies
2. UNIX for Beginners Questions & Answers
Hello,
I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies
3. UNIX for Dummies Questions & Answers
My input is as below :
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt
/splunk/scrubbed/triumph/ifind.triumph.txt
From the above input I want to extract the file names only .
Basically I want to... (5 Replies)
Discussion started by: IshuGupta
5 Replies
4. Shell Programming and Scripting
/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies
5. Shell Programming and Scripting
Hi,
I have a file abcd.txt which has contents in the form of full path file names i.e.
$home> vi abcd.txt
/a/b/c/r1.txt
/q/w/e/r2.txt
/z/x/c/r3.txt
Now I want to retrieve only the directory path name for each row
i.e
/a/b/c/
/q/w/e/
How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies
6. Shell Programming and Scripting
Hi,
I have a function getparam() which takes parameter name as input and parameter value as output.
I have a strting like this,
abcd#paramname1#efgh#paramname2#ijklmnopq
Above one is my input,
The strting enclosed in # are the parameter names.
Here question is, I have to get the... (0 Replies)
Discussion started by: anandapani
0 Replies
7. Shell Programming and Scripting
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
Discussion started by: royalibrahim
2 Replies
8. Shell Programming and Scripting
Hi,
I have a environmental variables,
ORACLE_HOME=/u01/oracle/ORCL/db/tech/10.2.0
ORACLE_SID=ORCL
Now I need to create a variable and need to extract some part from ORACLE_HOME. I need to get the path from ORACLE_HOME till ORACLE_SID as /u01/oracle/ORCL. I may need to check also... (6 Replies)
Discussion started by: sreejitnair123
6 Replies
9. Shell Programming and Scripting
Im trying to extract a directory from a path entered by the user
Lets say the path is
path=/home/bliss/files/myfile.txt
i wanna extract "/home/bliss/files" from $path ... how can i do this? (4 Replies)
Discussion started by: mrudula009
4 Replies
10. Shell Programming and Scripting
hi unix guru's..................:confused:
question is posted in the #3 permalink shown below. (3 Replies)
Discussion started by: yahoo!
3 Replies
chdir(2) System Calls Manual chdir(2)
NAME
chdir, fchdir - Changes the current directory
SYNOPSIS
#include <unistd.h>
int chdir ( const char *path );
int fchdir ( int filedes );
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
chdir(): XSH5.0
fchdir(): XSH5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the pathname of the directory. Specifies the file descriptor of the directory.
DESCRIPTION
The chdir() function changes the current directory to the directory indicated by the path parameter.
The fchdir() function changes the current directory to the directory indicated by the filedes parameter. If the path parameter refers to a
symbolic link, thechdir() function sets the current directory to the directory pointed to by the symbolic link.
The current directory, also called the current working directory, is the starting point of searches for pathnames that do not begin with a
/ (slash). In order for a directory to become the current directory, the calling process must have search access to the directory.
NOTES
The current working directory is shared between all threads within the same process. Therefore, one thread using the chdir() or fchdir()
functions will affect every other thread in that process.
RETURN VALUES
Upon successful completion, the chdir() function returns a value of 0 (zero). Otherwise, a value of -1 is returned and errno is set to
indicate the error.
ERRORS
If the chdir() function fails, the current directory remains unchanged and errno may be set to one of the following values: Search access
is denied for any component of the pathname. The path parameter points outside the process's allocated address space. An I/O error
occurred while reading from or writing to the file system. Too many symbolic links were encountered in translating the pathname. The
length of the path argument exceeds PATH_MAX or a pathname component is longer than NAME_MAX.
Pathname resolution of a symbolic link produced an intermediate result whose length exceeds PATH_MAX. The named directory does not
exist, or is an empty string. A component of the path prefix is not a directory.
If the fchdir() function fails, the current directory remains unchanged and errno may be set to one of the following values: The filedes
parameter is not a valid open file descriptor. The file descriptor does not reference a directory.
RELATED INFORMATION
Functions: chroot(2)
Commands: cd(1)
Standards: standards(5) delim off
chdir(2)