View Single Post

  #2 (permalink)  
Old 04-19-2008, 12:57 AM
rockdalinux's Avatar
rockdalinux rockdalinux is offline
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

Add eval before cd
Code:
#!/bin/sh

echo Where do you want to install the package? [$INSTALL_DIR]
read new_install_dir

eval "cd $new_install_dir"
echo "You are in $(pwd) directory"
eval used to read and concatenated together into a single command. This command is then read and executed by the shell. If there is a space between dirname it will not work e.g. "~/dir name"

HTH
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote