Hi All,
I want some command to migrate between the directories as below:
read x
cd /export/home/$x
Please advise.
Cheers,
Shazin
Hi All,
I want some command to migrate between the directories as below:
read x
cd /export/home/$x
Please advise.
Cheers,
Shazin
The code given reads x from your keyboard then you go the directory /export/home/x OK, but what has that got to do with "migrate"?
If you want some help, you will have to be a bit more clear...
Hi,
I just want the user to input the directory name in a script and it should migrate to the directory entered by the user.
Best Regards,
Shazin
In other words all you are missing is
echo " Please enter the directory name : "
But you realized that at the end of the script it exits and its as if you did nothing...
Is that your issue?
Hi,
The above script does not migrate to the required directory. It is as if nothing is happening.
Best Regards,
Shazin
Exactly!
Once a script has finished its execution you find yourself where you started...
Unless you source:
ant:/home/vbe $ more gugu
echo "Please enter dir: "
read DIR
cd $DIR
ant:/home/vbe $ chmod 777 gugu
ant:/home/vbe $ gugu
Please enter dir:
script
ant:/home/vbe $ . gugu
Please enter dir:
script
ant:/home/vbe/script $
Hi,
but I hace to be careful were to place the script. Is is not possible if we can fix like for ex /home/vbe and then take for scripts as an entry form User and then migrate to the path. Like I have shown you at the starting on the thread.
Thanks a lot...
Regards,
Shazin
just replace cd $DIR by cd /export/home/$DIR you mean? Yes
but it was not working...
Cheers
Shazin
??
ant:/sm/bin $ more gugu
echo "Please enter dir: "
read DIR
cd /home/vbe/$DIR
ant:/sm/bin $ gugu
Please enter dir:
script
ant:/sm/bin $
ant:/sm/bin $ . gugu
Please enter dir:
script
ant:/home/vbe/script $
echo "Please enter the directory name....."
read dir
cd $dir
echo " You are in `pwd` directory now"
Thanks
Namish
Hi,
You are not understanding my requirement :
Assume I am in
ant:/sm/bin
I wrote script
ant:/sm/bin>read DIR
cd /sm/usr/$DIR
It should go to
ex cd /sm/usr/scripts
Hope this makes clear.
Cheers,
Shazin