Comments
 
posted on August 23rd 2010, at 16:47
by lunarg

For a shell script to determine its own location, you can use this code snippet. It takes relative and absolute paths into account.

#!/bin/bash
if [[ $0 == '/'* ]]; then
	MYLOCATION="`dirname $0`"
else
	MYLOCATION="`pwd`"/"`dirname $0`"
fi
echo "My location is: $MYLOCATION"
Add a new comment
 
Your name:
Your e-mail:
Your comment:
 
Basic BBcode is supported.
Captcha:
Type the letters and numbers as shown.
/get/captcha/1713599869
Not readable? Get another.
 
 
 
 
« April 2024»
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    
 
Links
 
Quote
« I needed a password with eight characters so I picked Snow White and the Seven Dwarves. »