bashrc issue in cygwin - bash

I updated my .bashrc with following text to run ns2 and saved it.
export PATH=$PATH:/home/user/nsallinone-2.34/bin:/home/user/ns-allinone-2.34/tcl8.4.18/unix:/home/user/ns-allinone-2.34/tk8.4.18/unix
export LD_LIBRARY_PATH=/home/user/ns-allinone-2.34/otcl-1.13:/home/user/ns-allinone-2.34/lib
export TCL_LIBRARY=/home/user/nsallinone-2.34/tcl8.4.18/library
Now when i run my Cygwin, each time it displays error as:
-bash: $'\r': command not found
Even now i have removed the above text but it still gives error.
Do i have to recompile ./bashrc, if I have how i will do that?

Now when i run my Cygwin, each time it displays error as:
-bash: $'\r': command not found
It seems that you edited your .bashrc using an application that added CR to the file.
Running dos2unix would remove the CR:
dos2unix /path/to/.bashrc

Related

Command not found when opening terminal, possible conda issue?

for some reason whenever I open my terminal it immediately prints the following (after the "last login" line of course):
(eval):116: command not found: dirname
(eval):116: command not found: dirname
__add_sys_prefix_to_path:6: command not found: dirname
__add_sys_prefix_to_path:7: command not found: dirname
It appears that terminal still works fine, but I can't seem to figure out what the cause of these errors could be. The only thing I've "changed" in my terminal last time I used it was setting up a conda environment and installing some new packages.
Any ideas?
You have tampered with the PATH variable and your current PATH cannot figure out where your common utilities are located.
try:
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH
Fix the last entry you made in your bash_profile or zshrc file before you started encountering the error.

zsh: command not found -- no longer have access to basic utilities and all installed softwares or packages from the terminal

Looks like I have managed to scramble my path variable when installing flutter, and now running yarn, shows zsh: command not found: yarn
This was the command I ran that I started experiencing the zsh command not found:
echo 'export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin >> ~/.zshrc"
I ran the code solution suggested by #devnull https://stackoverflow.com/a/18428774/1766068
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH it would work when I open a new tab, but if I should restart the terminal it no longer works.
Open your ~/.zshrc file in a text editor and remove the last line. Then logout and login again.

How to fix the terminal "source" command on OSX Catalina

I try executing the below commands in my terminal.
$ source ~/.bash_profile or . ~/.bash_profile
and the system returns:
-bash: [[-s: command not found
I cannot think of anything extra information to provide.
I kept researching my issue and came across this stackoverflow post
I initially misunderstood the error message to mean the source command was not found. After reading the other post I tried running bash .bash_profile and the result was .bash_profile: line 11: [[-s: command not found. I had an error in my .bash_profile file. I commented out the line and tried running source .bash_profile and it worked.
The initial command not found did not relate to the source command, it related to the file I was running with source.
I hope this helps someone else.

terminal doesn't work after running source ~/.bash_profile

I'm a new python user. When I was installing postgresql and running the following order:
$vi ~/.bash_profile
Add PATH=/usr/pgsql-9.2/bin:$PATH before export PATH.
$source ~/.bash_profile
My terminal became very strange. It seemed that I could not logout of the .bash_profile environment. When I use any basic comments like cd, open, etc., something strange happens.
This is my output:
MynametekiMacBook-Air:~ Myname$ cd Documents/
-bash: dirname: command not found
MynametekiMacBook-Air:Documents Myname$ open ~/.bash_profile
-bash: open: command not found
MynametekiMacBook-Air:Documents Myname$ easy_install pip
-bash: easy_install: command not found
How would I fix this?
If you enter
$nano ~/.bash_profile
you will be able to edit your bash profile, you can remove the line that you added that is causing problems and try again, or see if there is a syntax error in what was entered. Once you've finished your edits you need to press ctl+o then enter to confirm and ctl+x to exit back to the bash prompt.
run /bin/mv ~/.bash_profile ~/.bp. Close your terminal. Reopen and look at the new .bp file with vim ~/.bp. Fix any errors and run mv ~/.bp ~/.bash_profile to revert.
Try export PATH=$PATH:/usr/pgsql-9.2/bin instead of Add PATH=/usr/pgsql-9.2/bin:$PATH. Because it looks like you made so your paths are being overwritten instead of being updated.

Shell script can't be run in cygwin

I have a script as below:
# /brickos/util/f.sh
set folder=`pwd`
cd /brickos/boot
make
firmdl3 -f brickOS.srec
cd $folder
when I run it in cygwin(minty.exe), I got error as below, but when I run them in terminal directly, no any errors! what can I do?
$ f.sh
/cygdrive/c/cygwin/brickos/util/f.sh: line 2: cd: /brickos/boot
: No such file or directory
/cygdrive/c/cygwin/brickos/util/f.sh: line 3: $'make\r': command not found
firmdl3: ERROR- failed to open brickOS.srec
/cygdrive/c/cygwin/brickos/util/f.sh: line 5: cd:
: No such file or directory
$'make\r': command not found
suggests the script is saved with Windows (CRLF) instead of Unix style (just LF) line endings. Try converting it to Unix format and see if that improves matters.

Resources