bash get current path
echo $PWD
bash get path of script
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
get the path of script bash
script_dir=$(dirname "$0") #assign path of the script
working_dir=$(pwd) # assign working directory,
#### script begin /home/aaa/bbb/script.sh###
SCRIPT=`realpath $0`
SCRIPTPATH=`dirname $SCRIPT`
echo $SCRIPT
echo $SCRIPTPATH
#########
home$ ./script.sh
output
/home/aaa/bbb/script.sh # echo $SCRIPT
/home/aaa/bbb/ # echo $SCRIPTPATH
to source your script
SCRIPT=`realpath $0`
SCRIPTPATH=`dirname $SCRIPT`
bash get path of command
type -a <command>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us