I feel silly for asking this. But I just realized I don't try this very often.
Is there a way for a shell script to find itself? Or more precisely, the
directory it is in?
I am trying to run a program that wants an ini file specified on the command
line; but it defaults to the assumption of
Use the command pwd.
On Sun, Jul 21, 2013 at 4:16 PM, Michael keybou...@gmail.com wrote:
I feel silly for asking this. But I just realized I don't try this very
often.
Is there a way for a shell script to find itself? Or more precisely, the
directory it is in?
I am trying to run a
Use the command pwd.
Nope. That tells me where the user is, not where the shell script is.
On Sun, Jul 21, 2013 at 4:16 PM, Michael keybou...@gmail.com wrote:
I feel silly for asking this. But I just realized I don't try this very often.
Is there a way for a shell script to find itself?
to expand on this answer you can use ` to save the result of the command. Try
this
HERE=`pwd`
echo $HERE
so now the current path is in a variable for your script to use.
On Jul 21, 2013, at 3:46 PM, John Musbach johnmusba...@gmail.com wrote:
Use the command pwd.
On Sun, Jul 21, 2013
On Sun, Jul 21, 2013 at 4:54 PM, Michael keybou...@gmail.com wrote:
Use the command pwd.
Nope. That tells me where the user is, not where the shell script is.
Are you sure? If you do say,
SCRIPT_DIR=`pwd`
echo $SCRIPT_DIR
the echo should return the directory the script ran in.
On Sun,
Hm, here is a discussion on Stack Overflow of your question.
http://online.wsj.com/article/SB10001424127887324348504578606493979321554.html
On Jul 21, 2013, at 4:23 PM, Michael keybou...@gmail.com wrote:
Use the command pwd.
Nope. That tells me where the user is, not where the shell script
On Jul 21, 2013, at 1:57 PM, John Musbach johnmusba...@gmail.com wrote:
On Sun, Jul 21, 2013 at 4:54 PM, Michael keybou...@gmail.com wrote:
Use the command pwd.
Nope. That tells me where the user is, not where the shell script is.
Are you sure? If you do say,
SCRIPT_DIR=`pwd`
Hm, here is a discussion on Stack Overflow of your question.
http://online.wsj.com/article/SB10001424127887324348504578606493979321554.html
I think that's the wrong paste :-).
But in response to that article: Our constitution puts the U.S. Supreme court
at the top; international courts
Hm, here is a discussion on Stack Overflow of your question.
http://online.wsj.com/article/SB10001424127887324348504578606493979321554.html
I think that's the wrong paste :-).
Correct one:
On 21 Jul 2013, at 14:16 , Michael keybou...@gmail.com wrote:
I feel silly for asking this. But I just realized I don't try this very often.
Is there a way for a shell script to find itself? Or more precisely, the
directory it is in?
Yes, but it depends on the shell.
DIR=$( cd $( dirname
There wasn't last time I tried this about 20 years ago. :-(
The reason is the architecture of the UNIX file system, where file contents
actually reside in inodes, and directory entries are really only links to
inodes.
For example, you create a script. Now you put a hard link to that script
11 matches
Mail list logo