Public
Authored by Sébastien Adam

Bash: knowing the directory of a script

How to know the full path of the location where a script is located.

Edited
script.sh 133 Bytes
  • Simplification proposée par OSBLC 💻:

    #!/bin/sh
    
    SCRIPT_DIR=`dirname $(readlink -f $0)`
    
    echo $SCRIPT_DIR # /full/path/to/script/location
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment