| UNIX/Linux Forum Archives · Rules and Guidelines · Disclaimer |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
![]() ![]() ![]() |
| Alsa |
Posted: Apr 21 2005, 07:00 PM
|
|
Newbie ![]() Group: Members Posts: 1 Member No.: 940 Joined: 21-April 05 |
Hi guys and gals.
Could someone offer a little help to this annoying UNIX problem please? Ok, I gotta make a little script that jumps to a directory held in the environmental variables i.e $ ./alsascript mypics would take me to $HOME/pics kinda thing. so i made this code: #!/bin/bash set -a _webspace=$HOME/public_html/ _powerpoint=$HOME/public_html/pp _databases=$HOME/public_html/ _spreadheets=$HOME/public_html/ set +a if [ -z "$1" ]; then echo argument is blank else eval cd $"$1" <<<<<<<<< ARGH! echo New working directory is: pwd Now, when i run it from BASH and put say... ./alsascript powerpoint it says "powerpoint" is not a directory. But if i change that line where i put ARGH! to eval cd $_powerpoint or any of the other variables it works so i assume the syntax on that line is wrong but i can't find anywhere what it should be. Any ideas to make it work remembering that it must be BASH only. Its probably so obvious but I'm pretty new to unix, thank you in advance! |
| andyb1ack |
Posted: Apr 26 2005, 03:33 PM
|
|
User Level: 4 ![]() ![]() ![]() ![]() Group: Members Posts: 98 Member No.: 513 Joined: 9-September 04 |
You've made this a bit complicated I think.
You could use aliases. If you execute the following command: alias spreadsheets='cd $HOME/public.html?#39; then you'd only have to type spreadsheets to be dropped into that directory. I don't know what script is run automatically when you log in with the bash shell (it's the .profile for the korn shell), but you could put these aliases into that file, along with your PATH settings etc. You can also put the following command into the file to display your "pwd" output on the command line (along with a blank line, hostname, and your logon: PS1=' '`hostname`':${PWD} '`whoami`' > ' export PS1 |
![]() |
![]() ![]() ![]() |