Answers for "bash get path of script"

0

bash get path of script

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
Posted by: Guest on January-18-2021
0

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`
Posted by: Guest on April-27-2021
0

bash get path of command

type -a <command>
Posted by: Guest on May-12-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language