Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
Get current directory from within the bash script:

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
echo "$SCRIPT_DIR"

dirname gets the current directory and cd will change the current directory, finally pwd will return the current working directory, which in our case will be stored in SCRIPT_DIR.

#linux #bash #script #shell #pwd #current_directory