are they any server variables in bash/SSH scripting as is in PHP or Perl, for example in PHP:
$_SERVER['DOCUMENT_ROOT'] or $_SERVER['HTTP_HOST']
I'm trying to retrieve the absolute path of an .SH script I'm running
thank you
are they any server variables in bash/SSH scripting as is in PHP or Perl, for example in PHP:
$_SERVER['DOCUMENT_ROOT'] or $_SERVER['HTTP_HOST']
I'm trying to retrieve the absolute path of an .SH script I'm running
thank you
To answer the question, yes there are variables.
As and example...the absolute path to the current script would be:
ABS_PATH=$(cd $(dirname $0); pwd)
what about
echo $PWD
But that won't give the path of the script being executed unless the user is executing the script from the directory in which it resides, it will give the working directory of the parent.
if using ksh.....
whence ${0}
true
that is my problem, i'm executing in from a different location
As my other post but with echo, to display the value.
ABS_PATH=$(cd $(dirname $0); pwd)
echo ${ABS_PATH}