01-08-2020
The wild card will be expanded in your script. It should work if exactly one single pattern matched; it fails if none or more than one matched.
Try a for loop in your script.
10 More Discussions You Might Find Interesting
1. 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
2. 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
3. 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
4. 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
5. 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
6. 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
7. 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
8. 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
9. 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
10. UNIX for Beginners Questions & Answers
What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies
chroot(2) System Calls Manual chroot(2)
NAME
chroot - Changes the effective root directory
SYNOPSIS
#include <unistd.h>
int chroot ( const char *path );
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
chroot(): XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the new effective root directory. If the path parameter refers to a symbolic link, the chroot() function sets the effective root
directory to the directory pointed to by the symbolic link.
DESCRIPTION
The chroot() function causes the directory named by the path parameter to become the effective root directory.
The effective root directory is the starting point when searching for a file's pathname that begins with a / (slash). The current working
directory is not affected by the chroot() function.
The calling process must have superuser privilege in order to change the effective root directory. The calling process must also have
search access to the new effective root directory.
The .. (dot-dot) entry in the effective root directory is interpreted to mean the effective root directory itself. Thus, .. (dot-dot) can-
not be used to access files outside the subtree rooted at the effective root directory.
RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. If the chroot() function fails, a value of -1 is returned and errno is set to
indicate the error.
ERRORS
If the chroot() function fails, the effective root directory remains unchanged and errno may be set to one of the following values: Search
permission is denied for any component of the pathname. The path parameter points outside the process' allocated address space. An I/O
error occurred while reading from or writing to the file system. More than MAXSYMLINKS symbolic links are encountered while resolving
path. The length of the path argument exceeds PATH_MAX or a pathname component is longer than NAME_MAX. The path parameter does not exist
or points to an empty string. A component of path is not a directory. The process does not have appropriate privilege.
RELATED INFORMATION
Functions: chdir(2)
Commands: cd(1)
Standards: standards(5) delim off
chroot(2)