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
I need to check whether the string "java" is there (consider "java" appears exactly one time for the time being), if it does exist I need to extract the path "/usr/bin/java".
Note: java path may appear at any position (i.e) it may be the first or the last path or appear in middle of the PATH setting. So my code should be efficient in handling all these
Hi:
I have a requirement as below:
I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l).
When any user logs on and types... (2 Replies)
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)
Hi
I need a script which will remove a path from PATH environment variable. For example
$echo PATH
/usr/local/bin:/usr/bin:test/rmve:/usr/games
$echo rmv
test/rmve
Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
I make this script that uses "strace" to trace programs. The script looks for files that the program opens. It looks like this
open("/lib/libtermcap.so.2", O_RDONLY) = 3
open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
I want to extract the path without the quotes, preferably using grep and... (4 Replies)
Hello Folks,
I want to append a path in user's PATH variable which should be available in current session.
Background
Numerous persons will run a utility.
Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example
start="BEGIN /home/mavkoup/data"
end="END"
sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Hi All,
Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created.
/Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt
/Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Currently I am using this laborious command
lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}'
Would like to know if there is any shorter method to get this mapping of... (2 Replies)
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
LEARN ABOUT DEBIAN
filecap
FILECAP:(8) System Administration Utilities FILECAP:(8)NAME
filecap - a program to see capabilities
SYNOPSIS
filecap [ -a | -d | /dir | /dir/file [cap1 cap2 ...] ]
DESCRIPTION
filecap is a program that prints out a report of programs with file based capabilities. If a file is not in the report or there is no
report at all, no capabilities were found. For expedience, the default is to check only the directories in the PATH environmental variable.
If the -a command line option is given, then all directories will be checked. If a directory is passed, it will recursively check that
directory. If a path to a file is given, it will only check that file. If the path to the file includes capabilities, then they are written
to the file.
OPTIONS -a This tells the program to show all capabilities starting from the / directory. Normally the PATH environmental variable is used to
show you capabilities on files you are likely to execute.
-d This dumps all capabilities for reference.
EXAMPLES
To check file capabilities in $PATH:
filecap
To check file capabilities of whole system:
filecap -a
To check file capabilities recursively in a directory:
filecap /usr
To check file capabilities of a specific program:
filecap /bin/passwd
To list all possible capabilities:
filecap -d
To set a file capability on a specific program:
filecap /bin/ping net_raw net_admin
SEE ALSO pscap(8), netcap(8), capabilities(7).
AUTHOR
Steve Grubb
Red Hat March 2009 FILECAP:(8)