I am trying to install oh-my-zsh on Ubuntu 15. After running the installation script
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
I have the following error which never occur before
/home/li-xinyang/.zshrc:3: command not found: ^M
/home/li-xinyang/.zshrc:9: command not found: ^M
/home/li-xinyang/.zshrc:12: command not found: ^M
/home/li-xinyang/.zshrc:16: command not found: ^M
/home/li-xinyang/.zshrc:19: command not found: ^M
/home/li-xinyang/.zshrc:22: command not found: ^M
/home/li-xinyang/.zshrc:25: command not found: ^M
/home/li-xinyang/.zshrc:28: command not found: ^M
/home/li-xinyang/.zshrc:31: command not found: ^M
/home/li-xinyang/.zshrc:34: command not found: ^M
/home/li-xinyang/.zshrc:39: command not found: ^M
/home/li-xinyang/.zshrc:44: command not found: ^M
/home/li-xinyang/.zshrc:47: command not found: ^M
/home/li-xinyang/.zshrc:52: command not found: ^M
/home/li-xinyang/.zshrc:53: command not found: ^M
/home/li-xinyang/.zshrc:55: command not found: ^M
/home/li-xinyang/.zshrc:58: command not found: ^M
/home/li-xinyang/.zshrc:source:59: no such file or directory: /home/li-xinyang/.oh-my-zsh/oh-my-zsh.sh^M
/home/li-xinyang/.zshrc:60: command not found: ^M
/home/li-xinyang/.zshrc:63: command not found: ^M
/home/li-xinyang/.zshrc:70: command not found: ^M
/home/li-xinyang/.zshrc:73: command not found: ^M
/home/li-xinyang/.zshrc:76: command not found: ^M
How can I remove ^M?
In my Mac ran dos2unix for all files installed by Oh-My-Zsh. In summary it was something like below. I kept rerunning source ~/.zshrc to check if the installation was OK, without any errors, until I have converted all files, including binary files.
brew install dos2unix
cd /Users/<your user>/.oh-my-zsh
find . -name " *.sh" | xargs dos2unix -f
find . -name " *.zsh" | xargs dos2unix -f
dos2unix -f themes/robbyrussel.zsh-theme
cd
dos2unix -f .zshrc
source ~/.zshrc
The solution is to set autocrlf=true to autocrlf=false use the command below,
git config --global core.autocrlf true
^M is carriage return (CR), Windows-style text line ending make.
I could resolve this error in Ubuntu by saving the file ~/.zshrc in LF mode.
I had the same issue, and autocrlf=true did not resolve the issue.
After I disabled the git plugin in ~/.zshrc by commenting it out, and removed & replaced the file which has the problem ^M, it was resolved. It seems git plugin on oh-my-zsh makes a conflict.
#plugins=(git)
Related
If I execute the following in terminal on my Macbook M1 Pro 2021 with ZSH
uglifyjs js/script.js --compress --mangle --output js/script.min.js -m reserved=['$','require','exports']
I get this error
zsh: no matches found: reserved=[$,require,exports]
But If I switch to bash then it's fine, can anyone help on this to get it fixed on ZSH?
Add quotes:
uglifyjs js/script.js --compress --mangle --output js/script.min.js \
-m "reserved=['$','require','exports']"
In both bash and zsh, square brackets are used for file globbing. The shell is attempting to find files that match the pattern reserved=[<one of these characters>]
In zsh, if there are no matches, you get an error. In bash if there are no matches, the shell silently includes the original pattern.
Which means in bash, you also want to use quotes to prevent file globbing. Otherwise, something like this can happen:
bash> echo reserved=['$','require','exports']
reserved=[$,require,exports]
bash> touch 'reserved=r'
bash> echo reserved=['$','require','exports']
reserved=r
I am trying to run a command similar to
> system("cat <(echo $PATH)")
which fails when run from within R or Rstudio with the following error message:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `cat <(echo $PATH)'
However, if I run this on the command line it works fine:
$ cat <(echo $PATH)
[...]/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
I checked that the shell I am using is bash using system("echo $SHELL"). Can anyone help me solving this?
This syntax works in bash but not sh. The $SHELL environment variable doesn't necessarily mean that is the shell being used. echo $0 will show your shell.
system("echo $0")
#> sh
You could force bash to be used like this
system("bash -c 'cat <(echo $PATH)'")
#> /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
I recently updated ZSH and now I'm seeing a zsh:command not found: important output whenever I do any command in the terminal.
❯ ls
...(lists all files)
zsh: command not found: important
❯ echo $PATH | tr ':' '\n'
/usr/local/opt/postgresql#10/bin
/Users/skube/.nvm/versions/node/v10.18.1/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
zsh: command not found: important
Where the heck is important?
It was something silly. I was in a git branch that had been erroneously named with a quoted important.
❯ git br
* Some-`important`-work
master
Interestingly, I could switch to this branch within VSCode, but not in Terminal. Also, in Terminal the branch displayed without important in the branch name, unit it was revealed as #lurker suggested with echo $PS1.
I tried to build binaries in RHEL6 using rpmbuild command.It throws file not found error during rpmbuild command execution. But In RHEL5 the same rpmbuild command is working fine.
RHEL5 execution result:
*Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.77266
umask 022
cd /usr/src/redhat/BUILD
LANG=C
export LANG
unset DISPLAY*
RHEL6 execution result:
*Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.BeMhyH
umask 022
cd //rpmbuild/BUILD
'[' //rpmbuild/BUILDROOT/ '!=' / ']'
rm -rf //rpmbuild/BUILDROOT/
++ dirname //rpmbuild/BUILDROOT/
mkdir -p //rpmbuild/BUILDROOT
mkdir //rpmbuild/BUILDROOT/
LANG=C
export LANG
unset DISPLAY
/usr/lib/rpm/check-buildroot*
I am not able to find any %install changes between the spec files. Any one please help me to understand what am i doing wrong?
Thanks in Advance..!
The only problem that is clear from the snippets provided is that $HOME is not defined in your rpmbuild environment. $HOME/rpmbuild is the default build root for 'rpmbuild' in RHEL6, instead of /usr/src/redhat as in RHEL5.
Things to consider:
Is there an '~/.rpmmacros' file that is altering the rpmbuild
directives.
The temporary %install script will not be deleted on
error-exit. Inspecting it directly might tell you more about why it failed.
Ex:
[user#host rpmbuild]$ rpmbuild -bb nano
<snip>
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.2uw1tZ (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.2uw1tZ (%install)
[user#host rpmbuild]$ cat /var/tmp/rpm-tmp.2uw1tZ
#!/bin/sh
RPM_SOURCE_DIR="/home/user/rpmbuild/SOURCES"
RPM_BUILD_DIR="/home/user/rpmbuild/BUILD"
...
Older recommendations were to nuke the target buildroot as the first step of %install. To help force a separation between the %build and %install steps, newer versions of rpmbuild strictly enforce it by doing it for you for the first step, as shown in what you pasted in.
I am assuming that your %build stage is putting one or more files into the target buildroot area, which it shouldn't be doing. It should all be in the build area only.
I've configured Heroku's Scheduler to run a Symfony 2 command:
bash app/console myapp:send:confirmations --verbose
And set it to be run each 10 minutes.
But, in the logs I see those messages:
2015-09-10T13:01:25.313711+00:00 heroku[api]: Starting process with command `bash app/console myapp:send:confirmations` by scheduler#addons.heroku.com
2015-09-10T13:01:44.151426+00:00 heroku[scheduler.7629]: Starting process with command `bash app/console myapp:send:confirmations --verbose`
2015-09-10T13:01:44.811500+00:00 heroku[scheduler.7629]: State changed from starting to up
2015-09-10T13:01:45.565021+00:00 app[scheduler.7629]: app/console: line 2: ?php: No such file or directory
2015-09-10T13:01:45.565093+00:00 app[scheduler.7629]: app/console: line 19: unexpected EOF while looking for matching `''
2015-09-10T13:01:45.565096+00:00 app[scheduler.7629]: app/console: line 28: syntax error: unexpected end of file
2015-09-10T13:01:46.291606+00:00 heroku[scheduler.7629]: State changed from up to complete
2015-09-10T13:01:46.278800+00:00 heroku[scheduler.7629]: Process exited with status 2
Those are the three relevant that are confusing me:
2015-09-10T13:01:45.565021+00:00 app[scheduler.7629]: app/console: line 2: ?php: No such file or directory
2015-09-10T13:01:45.565093+00:00 app[scheduler.7629]: app/console: line 19: unexpected EOF while looking for matching `''
2015-09-10T13:01:45.565096+00:00 app[scheduler.7629]: app/console: line 28: syntax error: unexpected end of file
I'm a bit confused: the file app/console seems not exist, but then the script encounters an unexpected EOF (but the file doesn't exist o.O) and then an unexpected end of file (isn't this the same thing as the message immediatley before?
What am I doing wrong?
Use php instead of bash to launch the console:
php app/console myapp:send:confirmations --verbose
I have the same behaviour (crash) on Ubuntu 15.04:
$ bash app/console
app/console: line 2: ?php: No such file or directory
app/console: line 18: unexpected EOF while looking for matching `''
app/console: line 23: syntax error: unexpected end of file
$ php app/console -v
Symfony version 2.7.4 - app/prod
...
It seems that the shebang from the start of app/console is ignored and the PHP interpreter is not called:
#!/usr/bin/env php
<?php
....
Here are explanations from Aaron Copley:
It's not executable
Run the binary with absolute or relative path
So if you mark the file as executable and launch the script with relative path, the PHP interpreter will be called:
$ chmod +x app/console
$ ./app/console -v
Symfony version 2.7.4 - app/prod