Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
After I have installed node, it works. I quit terminal and then I can't use node command in bash. Would anyone know why this is happening? Its rather infuriating. I think it may be something to do with the $PATH variable not being initialised in the right order or not at all.
I followed the 1st option https://gist.github.com/isaacs/579814
Thanks to #DavidWeldon and #Vinayak Mishra
Add export PATH=$HOME/local/bin:$PATH in ~/.bash_profile and source ~/.bash_profile or exit and open new terminal. Create ~/.bash_profile it isn't available already.
If there is a problem with the $PATH, you can check it with:
echo $PATH && source ~/.profile && echo $PATH
If there are difference, files are not being called in the right order. Take a look at this.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm looking for a way to correct bash commands if they have been misspelled.
Let's say you have installed a program called "FooBar" but you type "foobar" (or foo bar or FOOBAR or foebar) in your shell. Is there any way to check if something similar to what you are looking for exists in your PATH?
I'm thinking about writing a bash script that normalizes user input and uses the Levenshtein distance algorithm to check what they have typed against anything in PATH. But maybe there's already something is written out there or a better way to accomplish this task.
Any suggestions?
If you problem is case-sensitivity only, then you can switch this off in the readline configuration by the following:
echo "set completion-ignore-case On" >> ~/.inputrc
However, if you are seeking for some clever mechanism to execute similar commands (by using fuzzy logic for example) I'll not recommend to use such tool in a command-line since it could be very dangerous.
Imagine what could happen for example in commands like rmv? is it rm or mv? .. only the user can answer this question.
Note: This may be useful if you are running a Cygwin env where case-sensitivity is not a problem. In Linux commands are case sensitive. So switching this functionality off is not a good idea.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a expect script which opens an xterm
I figured out I need to use "exec" in order to open the xterm
exec xterm -e '...here is an expect script also..'
While I see it is OK to use several command in my script but not in that xterm script.
And later on I found all current environment variables are not set in that xterm
Why? Used bash some much and never meet that problem before. How can I let the xterm inherit all environment variables?
Independently from expect there is a rule of thumb for UNIX/Linux:
If you want to transfer a variable from parent process to its child process,
you must export this variable in the parent process.
You can check, if a variable XYZ has been exported indeed, using command
env|grep XYZ
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I have read the Linux FHS, but still feel a little confuse. If I have some utility shell scripts, shall I put them in /usr/bin or /usr/local/bin or ~/bin?
The FHS says the most user commands goes to /usr/bin, but it also says that administrater should install unpackaged app or host specific stuff in /usr/local, does that means the /usr/local/bin is a better place for my own scripts? Maybe ~/bin is better? I want to know the best way / conventions to do this. Thanks
First of all, I wouldn't put anything unpackaged inside /usr/bin, there's already way too much mess in there without adding unpackaged stuff. Leave it to the package manager.
Now, if they are system-wide scripts, I would put them into /usr/local/bin, which is usually way less crowded, is accessible to everyone and editable only by root; if, instead, they are just for your user, you should put them into ~/bin.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I was trying to create variables in my bash shell which I could use whenever I wanted. More specifically, I wanted to create a variable which could store the path to a folder, example:
mypath = `pwd`
However, I can't do the following:
cd $mypath
How can I resolve this? Also, I want to store this variable so I can use after I restart my system. Do I store this in the .bashrc file?
Don't use spaces in assignment, ie
mypath=`pwd`
Furthermore, if you want your variables to be globally available you can use the export command. Example: export mypath="pwd".
If you want the variables to persist after reboot, then you do need to add it to ~/.bashrc.
You can do this with nano ~/.bashrc and adding export mypath="pwd" to the end of the file
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I've found it's really difficult to setup path variable. I've tried a lot of combinations but nothing works at all. My over 1h work results are but as you see on screenshot (http://puu.sh/33n0X.png )
echo $PATH
give strange directory and
rm -rf k.txt
doesn't work at all. Does anyone has idea what is wrong there? I'm totally confused about it
If you want something a little more "normal", you can suppress the current PATH being appended, and just build your own.
In your ~/.bash_profile, put something to this effect
PATH=/bin
and if you want System32 you can add it as well
PATH=/bin:${TMP%U*}windows/system32
Example