i want to check a path if exist or not before pass it as argument
Asked
Active
Viewed 1,502 times
1 Answers
3
if [ -d /tmp ]
then
echo the directory exists
fi

Ian Purton
- 406
- 6
- 4
-
`i execute if [ -d / $1 ] ; then echo the directory exists else echo the directory not exists fi` .... but always the result is echo the directory not exists ....the command is root@host/>`./bash.sh text.txt ` – Mohammad AL-Rawabdeh Oct 06 '10 at 10:01
-
you need ";" before "else", additional one before "fi" won't hurt either. You also have a space between "/" and "$1" – Hubert Kario Oct 06 '10 at 10:14