viking777 Posted February 21, 2009 Report Share Posted February 21, 2009 If I type: echo $PATH as user I get: /bin /usr/bin /usr/local/bin /usr/games /usr/lib/qt4/bin /usr/bin /opt/kde3/bin I then type: export PATH=$PATH:/opt and I get: Unknown command “export†If I su to root and run: export PATH=$PATH:/opt that is accepted but it changes roots PATH not mine. How in hell do I change my user PATH variable to include /opt??? NB I only want to do it on a per session basis not permanently. Link to comment Share on other sites More sharing options...
viking777 Posted February 21, 2009 Author Report Share Posted February 21, 2009 (edited) Forget it, it is because I was using Fish. When I changed the shell back to bash it worked. But if anyone can tell me how to make it work in Fish I would love to know. It is a more 'friendly' shell. Edit: apart from this problem obviously. Edited February 21, 2009 by viking777 Link to comment Share on other sites More sharing options...
tyme Posted February 26, 2009 Report Share Posted February 26, 2009 It is a more 'friendly' shell. Edit: apart from this problem obviously. - took the words right out of my mouth :P I believe you need to use "set", though I'm not versed in it's syntax: http://www.fishshell.org/user_doc/commands.html#set Link to comment Share on other sites More sharing options...
scoonma Posted March 6, 2009 Report Share Posted March 6, 2009 Yeah, using "set" for (environment) variables is quite common in shells other than bash. Guess it should be this way: set -x PATH $PATH:/opt Link to comment Share on other sites More sharing options...
tyme Posted March 6, 2009 Report Share Posted March 6, 2009 (edited) Yeah, using "set" for (environment) variables is quite common in shells other than bash.I never got why it was "export" - every time I used it, I always thought, "where am I exporting this variable to? Am I not just setting it?" :unsure: set makes much more sense. Edited March 6, 2009 by tyme Link to comment Share on other sites More sharing options...
viking777 Posted March 9, 2009 Author Report Share Posted March 9, 2009 Yeah, using "set" for (environment) variables is quite common in shells other than bash.Guess it should be this way: set -x PATH $PATH:/opt scoonma, since you are the one who told me about this (and I thank you again) it seems pretty churlish of me to go correcting you, so I apologise in advance. But I tried your command and it didn't work, a little bit of digging and I found the answer. This is what you need (in the fish shell anyway): set PATH[7] /opt This command will set /opt as the 7th entry in your environment variable PATH. It does seem to be a lot easier than the 'export' command in bash. Link to comment Share on other sites More sharing options...
tyme Posted March 10, 2009 Report Share Posted March 10, 2009 set PATH[7] /opt This command will set /opt as the 7th entry in your environment variable PATH. It does seem to be a lot easier than the 'export' command in bash. But what's it do if you have 8 entry's in PATH already? Does it overwrite #7, or does it shift 7 to 8 and 8 to 9, then put the new one in 7? There has to be a way to do it that doesn't risk overwriting existing PATH entries. Link to comment Share on other sites More sharing options...
viking777 Posted March 11, 2009 Author Report Share Posted March 11, 2009 It doesn't over write anything, it just moves other entries along. I know, I used that command myself (and I have more than 7 entries). But if it really worries you then count how many entries you have to start with and put it at the end. Link to comment Share on other sites More sharing options...
scoonma Posted March 21, 2009 Report Share Posted March 21, 2009 scoonma, since you are the one who told me about this (and I thank you again) it seems pretty churlish of me to go correcting you, so I apologise in advance. But I tried your command and it didn't work, a little bit of digging and I found the answer. In fact I have to admit that I don't use fish myself, but found a linke to some useful docs. Another version is here: Fish user docs I supposed you needed the export of your path variable: "Exporting variables Variables in fish can be exported. This means the variable will be inherited by any commands started by fish. It is convention that exported variables are in uppercase and unexported variables are in lowercase." Link to comment Share on other sites More sharing options...
tyme Posted March 27, 2009 Report Share Posted March 27, 2009 (edited) I believe you need to use "set", though I'm not versed in it's syntax:http://www.fishshell.org/user_doc/commands.html#set In fact I have to admit that I don't use fish myself, but found a linke to some useful docs. Another version is here:Fish user docs I supposed you needed the export of your path variable: "Exporting variables Variables in fish can be exported. This means the variable will be inherited by any commands started by fish. It is convention that exported variables are in uppercase and unexported variables are in lowercase." :blink: Edited March 27, 2009 by tyme Link to comment Share on other sites More sharing options...
viking777 Posted March 27, 2009 Author Report Share Posted March 27, 2009 Tyme, I am not sure if your post was meant for me or scoonma. In case it was for me can I tell you I gave up on this a while back. Setting/Exporting variables in Fish was something I wanted to do once only, never before and never again after. What ever I did at the time worked for me but I don't really want to go back there! Hell, I don't even like the command line. I ony started using Fish because I thought it might make cli a bit easier than bash - and it does to some extent, but not enough to make me want to use it too often! Thanks for the post anyway. Link to comment Share on other sites More sharing options...
tyme Posted March 27, 2009 Report Share Posted March 27, 2009 The post was simply meant to point out that I had already referred to the documents and details that scoonma posted, that's all.... :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now