Write a shell script to change a directory?



echo  “ enter a directory name “
read dname
if [ -d “$dname” ]
cd $ dname
echo “ you are currently in “
pwd
else
echo “ directory doesnot exist “
exit
fi
OUTPUT:
enter a directory name
dir
directory dir exist
you are currently in
/ home / user / dir

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart