![]() |
Environment variable question
Hey guys,
I'm trying to make an environmental variable RPMS that will resolve to a website. I know I have to make the changes in .bash_profile, but all the things I try don't seem to want to work. I've tried: PATH=$RPMS:ftp://rha-server/pub/os/rhel5/Server/ or simply just making the variable itself $RPMS=ftp://rha-server/pub/os/rhel5/Server/ The second one made a variable just fine, but when I attempted to run this command: rpm -ihv $RPMS/caching-nameserver* It was giving me problems. Any ideas? |
If you need to add a env path, it should something like this,
Quote:
http://www.rpm.org/max-rpm/s1-rpm-in...g-install.html |
Quote:
|
What kind of problems? The command looks like it should work to me, barring this:
$RPMS= shouldn't work, as you can't have $ when setting a variable. Perhaps it's jut a typo in your post though. If you want your variable to be visible inside scripts and subshells, however, you'll also have to export it. Code:
export RPMS=ftp://rha-server/pub/os/rhel5/Server/ |
I found that webpage too, but it's still giving me a:
error: file not found by glob: /caching-server* Does that mean the path is successful, it's just the glob that's messing it up? I tried to take the wild card out, but it gave me the same error. |
Try echoing the line to see exactly what command the shell is trying to run:
Code:
echo rpm -ihv $RPMS/caching-nameserver*When the shell does globbing, it first tries to match the given pattern with any existing filenames and, if any are found, replaces the string with them. If it doesn't find anything, then it passes the string literally to the command. In this case, the string "/caching-nameserver*" means the shell is looking for filenames beginning with that string, like "/caching-nameserver-foo", isn't finding anything like that, and giving the literal string to rpm, which errors out on it. This is probably mostly because the variable isn't being set properly. But also, is "caching-nameserver" part of the filenames you want to match, or is it a directory name? Perhaps you want to use "cashing-nameserver/*" instead? It may help more if you can give us some more background on what you're trying to accomplish. Can you show us the exact series of commands you're trying to run here? And the commands you actually want it to run? It should be something like this: Code:
Finally, please use [code][/code] tags around any code you post, to preserve formatting and to improve readability. Edit: actually, I'm wondering now--I doubt very much that you can do globbing like this. Globbing is done by the shell, which only does local file-tree matching and string substitution. The ftp lookup is done by rpm, after the globbing is completed. So trying to use "*" to match multiple files is probably no good, unless rpm has it's own ability to glob over ftp. |
| All times are GMT -5. The time now is 04:16 AM. |