10-31-2010
Try the realpath() function on $0.
This is a common question and there is no completely all-purpose perfect answer because there are a lot of ways code can be invoked... realpath on $0 is a decent start.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi Folks,
In a Unix (ksh) script, is there a way to determine the current working directory path of another logged-in user? Of course, I can use "pwd" to find my own path. But, how do I find it for another active user?
Thanks for any input you can provide. LY (6 Replies)
Discussion started by: liteyear18
6 Replies
2. IP Networking
How to retrieve the path of Java bin directory in AIX (or any unix OS)??
Actually my problem is,
I have a jar file called App.jar. I want to execute it by calling the javaw executable.
My command is "/usr/java130/javaw -jar App.jar".
I've written this command into a shell script. Now,... (2 Replies)
Discussion started by: fermisoft
2 Replies
3. Programming
Is there a way to find the address of stack memory writing a program? Please guide me (12 Replies)
Discussion started by: jacques83
12 Replies
4. Shell Programming and Scripting
I have to relatively get the path of a file to use it in the script.
The directory structure is /export/opt/XTools/ and under this there are several version directories - 1.0_A0, 1.0_A1, 1.0_A2 etc.,. The actual file is under these directories: installscript.sh
My script should pickup the... (4 Replies)
Discussion started by: chiru_h
4 Replies
5. Shell Programming and Scripting
Hi,
I just want to know any code by which i can get the path of the script which i am running. This is required to store the output in the same directory from where the script is running. pwd fails if I give absolute path of script from some other directory.
Thanks in advance
Puneet (3 Replies)
Discussion started by: puneet
3 Replies
6. UNIX for Dummies Questions & Answers
I have a file that has multiple entries within the Unix system. Korn shell scripts are calling this file (also a ksh) with a . in front of it, and I'm trying to determine which file it is using based on the $PATH by finding where it is located first.
Any suggestion on how to go about this?... (2 Replies)
Discussion started by: gavineq
2 Replies
7. Fedora
Hello sir,
I am using a fedora 9 system.
I wanted to update the path to include the $HOME into the path.
So what we do is :
This will update the path.
I want to do the same thing by writing it in a shell prgram.
I wrote the above code in an "a.sh" file and executed it using "bash a.sh".BUt... (1 Reply)
Discussion started by: nsharath
1 Replies
8. UNIX for Advanced & Expert Users
How can i find( or list) contents of all registers being used by my program?
Is there any system call or library available for this?:confused:
At runtime in my c/c++ program. At runtime using may be some assembly hack!!!!!!!!!!! (2 Replies)
Discussion started by: amit gangarade
2 Replies
9. Shell Programming and Scripting
I am trying to put together a script to find a requested script or program on the user's search path. Am trying to replace the colons separating the parts of a path with a newline to let xargs pass the directories to a list command, but I haven't gotten that far. This is my progress:
echo... (7 Replies)
Discussion started by: wbport
7 Replies
10. Solaris
Hi all,
Recently i wanted to see if i have openssl installed in my system (solaris 10), so i do this (not sure if this is the right way to do this)
pkginfo -i | grep -i "ssl"
system SUNWopenssl-commands OpenSSL Commands (Usr)
system SUNWopenssl-include ... (3 Replies)
Discussion started by: javanoob
3 Replies
LEARN ABOUT X11R4
realpath
REALPATH(1) User Commands REALPATH(1)
NAME
realpath - print the resolved path
SYNOPSIS
realpath [OPTION]... FILE...
DESCRIPTION
Print the resolved absolute file name; all but the last component must exist
-e, --canonicalize-existing
all components of the path must exist
-m, --canonicalize-missing
no path components need exist or be a directory
-L, --logical
resolve '..' components before symlinks
-P, --physical
resolve symlinks as encountered (default)
-q, --quiet
suppress most error messages
--relative-to=DIR
print the resolved path relative to DIR
--relative-base=DIR
print absolute paths unless paths below DIR
-s, --strip, --no-symlinks
don't expand symlinks
-z, --zero
end each output line with NUL, not newline
--help display this help and exit
--version
output version information and exit
AUTHOR
Written by Padraig Brady.
REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report realpath translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
readlink(1), readlink(2), realpath(3)
Full documentation at: <http://www.gnu.org/software/coreutils/realpath>
or available locally via: info '(coreutils) realpath invocation'
GNU coreutils 8.28 January 2018 REALPATH(1)