I have a Rails app that I am hosting on Heroku, and hosting images on a Amazon S3. I am trying to add my Amazon credentials to my app using:
heroku config:add aws_access_key:<your access key> aws_secret_key:<your secret key>
I keep getting the error:
zsh: parse error near `n'
I have no idea what the problem is.
infused
23.8k13 gold badges67 silver badges77 bronze badges
asked Mar 9, 2014 at 5:23
3
Most likely your keys contain some characters that have special meaning to zsh.
Use single quotes ('
) around your keys:
heroku config:add aws_access_key='<your access key>' aws_secret_key='<your secret key>'
If there are any single quotes in your keys write '''
instead. For example, instead of
aws_access_key=stevie's key
write
aws_access_key='stevie'''s key'
Explanation: anything between a pair of single qoutes is taken exactly as it is written, there will be no parameter or command substitution or escape codes. As the second '
ends the quote any '
you want to write has to be quoted in anoter way outside of a pair of single quotes, either '
or "'"
.
answered Mar 11, 2014 at 12:03
AdaephonAdaephon
16.2k1 gold badge53 silver badges70 bronze badges
4
I have the same error, and resolved it . because I type like this
$ heroku config:set AWS_SECRET_KEY=<A2D3F4H5A6D7HJ8KHF9>
then got the error.
change like That:
$ heroku config:set AWS_SECRET_KEY=A2D3F4H5A6D7HJ8KHF9
success
answered Jul 8, 2020 at 17:44
chengxcv5chengxcv5
1371 silver badge10 bronze badges
You probably have some «special» characters in your Amazon access key or secret key which ZSH is interpreting. You usually need to «escape» these characters, but in this case you should be able to put the strings in quotes.
Try this instead (note the quotes around the values)
heroku config:add aws_access_key="<your access key>" aws_secret_key="<your secret key>"
answered Mar 10, 2014 at 12:11
jordelverjordelver
8,2422 gold badges31 silver badges40 bronze badges
1
I was facing the same error while trying to do a commit in GitHub. Turns out, <> are reserved, so of course I could NOT name anything within them.
Posting this for SEO purposes for whoever faces the same issue in GitHub.
answered Feb 13, 2020 at 0:11
1
I have a Rails app that I am hosting on Heroku, and hosting images on a Amazon S3. I am trying to add my Amazon credentials to my app using:
heroku config:add aws_access_key:<your access key> aws_secret_key:<your secret key>
I keep getting the error:
zsh: parse error near `n'
I have no idea what the problem is.
infused
23.8k13 gold badges67 silver badges77 bronze badges
asked Mar 9, 2014 at 5:23
3
Most likely your keys contain some characters that have special meaning to zsh.
Use single quotes ('
) around your keys:
heroku config:add aws_access_key='<your access key>' aws_secret_key='<your secret key>'
If there are any single quotes in your keys write '''
instead. For example, instead of
aws_access_key=stevie's key
write
aws_access_key='stevie'''s key'
Explanation: anything between a pair of single qoutes is taken exactly as it is written, there will be no parameter or command substitution or escape codes. As the second '
ends the quote any '
you want to write has to be quoted in anoter way outside of a pair of single quotes, either '
or "'"
.
answered Mar 11, 2014 at 12:03
AdaephonAdaephon
16.2k1 gold badge53 silver badges70 bronze badges
4
I have the same error, and resolved it . because I type like this
$ heroku config:set AWS_SECRET_KEY=<A2D3F4H5A6D7HJ8KHF9>
then got the error.
change like That:
$ heroku config:set AWS_SECRET_KEY=A2D3F4H5A6D7HJ8KHF9
success
answered Jul 8, 2020 at 17:44
chengxcv5chengxcv5
1371 silver badge10 bronze badges
You probably have some «special» characters in your Amazon access key or secret key which ZSH is interpreting. You usually need to «escape» these characters, but in this case you should be able to put the strings in quotes.
Try this instead (note the quotes around the values)
heroku config:add aws_access_key="<your access key>" aws_secret_key="<your secret key>"
answered Mar 10, 2014 at 12:11
jordelverjordelver
8,2422 gold badges31 silver badges40 bronze badges
1
I was facing the same error while trying to do a commit in GitHub. Turns out, <> are reserved, so of course I could NOT name anything within them.
Posting this for SEO purposes for whoever faces the same issue in GitHub.
answered Feb 13, 2020 at 0:11
1
- Index
- » Applications & Desktop Environments
- » [SOLVED] zsh parse error near `n’ on last line
Pages: 1
#1 2016-12-06 18:09:33
- saultdon
- Member
- From: Treaty 08
- Registered: 2013-06-25
- Posts: 41
[SOLVED] zsh parse error near `n’ on last line
I made changes to some functions in my .zshrc.local file with nano and now zsh can’t source it at all.
The nano command I use is
# nano -LES -T 4 -w$ .zshrc.local
I get this error when I open a new terminal:
/home/saultdon/.zshrc.local:102: parse error near `n'
Line 102 is the last line in the file.
I tried deleting the last newline and even running dos2unix thinking it was a dos newline issue but still get the same result.
Here’s some info that might be useful:
% ls -lah
...
lrwxrwxrwx 1 saultdon users 16 Feb 15 2014 .zshrc -> /etc/skel/.zshrc
lrwxrwxrwx 1 saultdon users 14 Feb 15 2014 .zshrc.global -> /etc/zsh/zshrc
lrwxrwxrwx 1 saultdon users 24 Mar 15 2014 .zshrc.local -> /usr/local/etc/zsh/zshrc
lrwxrwxrwx 1 saultdon users 28 Mar 15 2014 .zshrc.pre -> /usr/local/etc/zsh/zshrc.pre
% pacman -Ss zsh | grep installed
extra/grml-zsh-config 0.12.6-1 [installed]
extra/zsh 5.2-2 [installed]
community/zsh-completions 0.22.0-1 [installed]
community/zsh-syntax-highlighting 0.5.0-1 [installed]
Contents of .zshrc.local
% cat .zshrc.local
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000000
SAVEHIST=$HISTSIZE
setopt appendhistory hist_ignore_all_dups autocd extendedglob nomatch
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/saultdon/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# enable colors!
autoload -U colors && colors
# The "command not found" hook for pkgfile
source /usr/share/doc/pkgfile/command-not-found.zsh
# aliases be here
alias nano='nano -LES -T 4 -w$'
alias ls='ls --color=auto'
alias dmesg='dmesg -HL'
alias makepkg='makepkg -Cfis --noconfirm'
alias reflector='sudo reflector --verbose -l 10 -f 10 -p https --country "Canada" --country "United States" --save /etc/pacman.d/mirrorlist'
alias rsync_del='rsync -hav4 --stats --progress --delete --exclude "System Volume Information" --exclude $RECYCLE.BIN --exclude .directory'
alias rsync_dry='rsync -hav4 --stats --progress --delete --dry-run --exclude "System Volume Information" --exclude $RECYCLE.BIN --exclude .directory'
alias cower='cower -c'
# functions for world peace
h() { if [ -z "$*" ]; then history 1; else history 1 | egrep "$@"; fi; }
mnt() { test -e $1 || if grep /mnt/$1 /proc/mounts; then sudo umount /mnt/$1; else sudo mount /mnt/$1; fi; }
spatialite_mkvalid() {
for db in "${1}"
do
echo ' '... vacuuming "${db}"
spatialite -silent "${db}" "PRAGMA page_size = 65536; PRAGMA page_cost = 100000; VACUUM;"
for layer in $(ogrinfo "${db}" | tail -n+3 | cut -d ' ' -f 2)
do
echo ' '... repairing "${layer}"
spatialite -silent "${db}" "UPDATE "${layer}" SET GEOMETRY = ST_MakeValid(GEOMETRY) WHERE ST_IsValid(GEOMETRY) = 0;"
done
echo ' '... repaired "${db}" and vacuuming
spatialite -silent "${db}" "VACUUM;"
done
}
asus_fan() {
sudo modprobe -r asus-fan
sudo modprobe asus-fan
sudo asus-fan-create-symlinks.sh
sudo systemctl restart fancontrol
}
fix_geom() {
for tbl in $(ogrinfo pg:"host=sfngis dbname=witaskewin" | grep ${1} | cut -d ' ' -f 2)
do
psql -h sfngis -d witaskewin -a << EOF
done
UPDATE ${tbl} SET geom = ST_MakeValid(geom) WHERE ST_IsValid(geom) IS FALSE;
VACUUM ANALYZE ${tbl};
REINDEX TABLE ${tbl};
EOF
}
truncate_tbl() {
for tbl in $(ogrinfo pg:"host=sfngis dbname=witaskewin" | grep ${1} | cut -d ' ' -f 2)
do
psql -h sfngis -d witaskewin -a -c "TRUNCATE ${tbl} RESTART IDENTITY;"
done
}
# zsh-syntax-highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Pacman alias examples
alias pacupg='sudo pacman -Syu' # Synchronize with repositories and then upgrade packages that are out of date on the local system.
alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
alias pacrep='pacman -Si' # Display information about a given package in the repositories
alias pacreps='pacman -Ss' # Search for package(s) in the repositories
alias pacloc='pacman -Qi' # Display information about a given package in the local database
alias paclocs='pacman -Qs' # Search for package(s) in the local database
alias paclo="pacman -Qdt" # List all packages which are orphaned
alias pacc="sudo pacman -Scc" # Clean cache - delete all not currently installed package files
alias paclf="pacman -Ql" # List all files installed by a given package
alias pacexpl="pacman -D --asexp" # Mark one or more installed packages as explicitly installed
alias pacimpl="pacman -D --asdep" # Mark one or more installed packages as non explicitly installed
# '[r]emove [o]rphans' - recursively remove ALL orphaned packages
alias pacro="pacman -Qtdq > /dev/null && sudo pacman -Rns $(pacman -Qtdq | sed -e ':a;N;$!ba;s/n/ /g')"
# Additional pacman alias examples
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
Last edited by saultdon (2016-12-06 18:48:45)
«We don’t inherit the land from our ancestors — we borrow it from our children.»
#2 2016-12-06 18:18:47
- Trilby
- Inspector Parrot
- Registered: 2011-11-29
- Posts: 27,833
- Website
Re: [SOLVED] zsh parse error near `n’ on last line
The EOF on line 67 needs to be unindented. Otherwise the here document never ends.
Also you probably should get rid of that pacupd and pacmir aliases — they will not cause parsing issues, but an alias for commands that you should really never use doesn’t serve much purpose. If you do regularly use those commands, you are essentially playing russion roulette with your installation.
«UNIX is simple and coherent…» — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman
#3 2016-12-06 18:21:13
- saultdon
- Member
- From: Treaty 08
- Registered: 2013-06-25
- Posts: 41
Re: [SOLVED] zsh parse error near `n’ on last line
Trilby wrote:
The EOF on line 67 needs to be unindented. Otherwise the here document never ends.
Thanks just did that and also had to move the closing curly bracket so it looked like
at the end of the function.
«We don’t inherit the land from our ancestors — we borrow it from our children.»
#4 2016-12-06 18:23:11
- Trilby
- Inspector Parrot
- Registered: 2011-11-29
- Posts: 27,833
- Website
Re: [SOLVED] zsh parse error near `n’ on last line
Actually the done is out of place. That really makes no sense the way it is written. The for loop doesn’t get a done, you just have «done» as the first line of each here document.
«UNIX is simple and coherent…» — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman
#5 2016-12-06 18:26:46
- saultdon
- Member
- From: Treaty 08
- Registered: 2013-06-25
- Posts: 41
Re: [SOLVED] zsh parse error near `n’ on last line
So I need to place done after the EOF?
From the command line, this works:
for tbl in $(ogrinfo pg:"host=sfngis dbname=witaskewin" | grep econ_ | cut -d ' ' -f 2); do psql -h sfngis -d witaskewin -a << EOF; done
UPDATE ${tbl} SET geom = ST_MakeValid(geom) WHERE ST_IsValid(geom) IS FALSE;
VACUUM ANALYZE ${tbl};
REINDEX TABLE ${tbl};
EOF
And the function actually works as expected when I call it. But just today the n error came up and this wasn’t the function I was messing with.
«We don’t inherit the land from our ancestors — we borrow it from our children.»
#6 2016-12-06 18:30:31
- Trilby
- Inspector Parrot
- Registered: 2011-11-29
- Posts: 27,833
- Website
Re: [SOLVED] zsh parse error near `n’ on last line
What you just posted is completely different from what is in your shellrc file posted in the first post. What you just posted will work, but it is hard to read. Putting the «done» on the life after the EOF at the end of the here document will always work and is easier for humans to parse. Putting the «done» inside the here document as you have done in your rc file will never work.
Note that the following two examples are completely different:
cat <<EOF > outfile
Hello World
EOF
cat <<EOF
> outfile
Hello World
EOF
The first prints «hello world» into a file called outfile and outputs nothing. The second one only writes to the stdout printing the text «> outfile» and «Hello world». A here document begins at the first line after the starting «EOF» symbol.
For a loop consider three formats:
# Example A:
for a in INPUT; do
SOME_COMMAND << EOF
here document contents here
more here document contents here
EOF
done
# Example B:
for a in INPUT; do
SOME_COMMAND << EOF; done
here document contents here
more here document contents here
EOF
# Example C:
for a in INPUT; do
SOME_COMMAND << EOF
done
here document contents here
more here document contents here
EOF
A or B will work as desired. But B is confusing to a human reader while A is easier to understand.
C will just completely fail as the «done» command is just part of the here document and the for loop
is never closed.
In every case, the closing «EOF» must be unindented at the start of the line. Here documents are handy, but by necessity they often screw up the indentation we use to visually separate logical blocks.
«UNIX is simple and coherent…» — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman
#7 2016-12-06 18:39:57
- saultdon
- Member
- From: Treaty 08
- Registered: 2013-06-25
- Posts: 41
Re: [SOLVED] zsh parse error near `n’ on last line
Yup, cause that’s what I typed at the command line to make sure it worked before making it a function (which was also working since I made it a function months ago) — so I got confused about the error today.
But hey! for some reason placing the done at the end of the function, after EOF worked like you’ve pointed out.
Not sure why it worked before in it’s original form then all of a sudden started getting the error after changing the mnt() function…
But looks like all is well, thank a lot for your help.
«We don’t inherit the land from our ancestors — we borrow it from our children.»
#8 2016-12-06 18:48:29
- saultdon
- Member
- From: Treaty 08
- Registered: 2013-06-25
- Posts: 41
Re: [SOLVED] zsh parse error near `n’ on last line
And thanks again for your helpful for loop education.
I can see how examples B and C are different and just assumed that the ‘;’ could be translated to a newline when making a function but apparently not.
«We don’t inherit the land from our ancestors — we borrow it from our children.»
Содержание
- Arch Linux
- #1 2016-12-06 18:09:33
- [SOLVED] zsh parse error near `n’ on last line
- #2 2016-12-06 18:18:47
- Re: [SOLVED] zsh parse error near `n’ on last line
- #3 2016-12-06 18:21:13
- Re: [SOLVED] zsh parse error near `n’ on last line
- #4 2016-12-06 18:23:11
- Re: [SOLVED] zsh parse error near `n’ on last line
- #5 2016-12-06 18:26:46
- Re: [SOLVED] zsh parse error near `n’ on last line
- #6 2016-12-06 18:30:31
- Re: [SOLVED] zsh parse error near `n’ on last line
Arch Linux
You are not logged in.
#1 2016-12-06 18:09:33
[SOLVED] zsh parse error near `n’ on last line
I made changes to some functions in my .zshrc.local file with nano and now zsh can’t source it at all.
The nano command I use is
I get this error when I open a new terminal:
Line 102 is the last line in the file.
I tried deleting the last newline and even running dos2unix thinking it was a dos newline issue but still get the same result.
Here’s some info that might be useful:
Contents of .zshrc.local
Last edited by saultdon (2016-12-06 18:48:45)
«We don’t inherit the land from our ancestors — we borrow it from our children.»
#2 2016-12-06 18:18:47
Re: [SOLVED] zsh parse error near `n’ on last line
The EOF on line 67 needs to be unindented. Otherwise the here document never ends.
Also you probably should get rid of that pacupd and pacmir aliases — they will not cause parsing issues, but an alias for commands that you should really never use doesn’t serve much purpose. If you do regularly use those commands, you are essentially playing russion roulette with your installation.
«UNIX is simple and coherent. » — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman
#3 2016-12-06 18:21:13
Re: [SOLVED] zsh parse error near `n’ on last line
The EOF on line 67 needs to be unindented. Otherwise the here document never ends.
Thanks just did that and also had to move the closing curly bracket so it looked like
at the end of the function.
«We don’t inherit the land from our ancestors — we borrow it from our children.»
#4 2016-12-06 18:23:11
Re: [SOLVED] zsh parse error near `n’ on last line
Actually the done is out of place. That really makes no sense the way it is written. The for loop doesn’t get a done, you just have «done» as the first line of each here document.
«UNIX is simple and coherent. » — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman
#5 2016-12-06 18:26:46
Re: [SOLVED] zsh parse error near `n’ on last line
So I need to place done after the EOF?
From the command line, this works:
And the function actually works as expected when I call it. But just today the n error came up and this wasn’t the function I was messing with.
«We don’t inherit the land from our ancestors — we borrow it from our children.»
#6 2016-12-06 18:30:31
Re: [SOLVED] zsh parse error near `n’ on last line
What you just posted is completely different from what is in your shellrc file posted in the first post. What you just posted will work, but it is hard to read. Putting the «done» on the life after the EOF at the end of the here document will always work and is easier for humans to parse. Putting the «done» inside the here document as you have done in your rc file will never work.
Note that the following two examples are completely different:
The first prints «hello world» into a file called outfile and outputs nothing. The second one only writes to the stdout printing the text «> outfile» and «Hello world». A here document begins at the first line after the starting «EOF» symbol.
For a loop consider three formats:
A or B will work as desired. But B is confusing to a human reader while A is easier to understand.
C will just completely fail as the «done» command is just part of the here document and the for loop
is never closed.
In every case, the closing «EOF» must be unindented at the start of the line. Here documents are handy, but by necessity they often screw up the indentation we use to visually separate logical blocks.
«UNIX is simple and coherent. » — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman
Источник
wget error–“zsh: parse error near &”
There is no doubt that I prefer wget way over any other type of downloads…
Syntax: wget <DOWNLOAD_URL>
If you get this error “zsh: parse error near &” then its probably because your download URL has a “&” so you should try giving your DOWNLOAD_URL in double quotes
wget “<DOWNLOAD_URL>”
If you are trying to download from a site which needs you to give your credentials then you can try giving it this way
wget —http-user=<UserName> —http-password=<Password> “<DOWNLOAD_URL>”
Hope this helps
Popular posts from this blog
You might want to test for if a String is empty many a times. Before we jump onto the numerous solutions available let us take a look at how we define “Empty String” The difference in the two methods given by Apache and Java are dependent on how we define an empty string. Java String.isEmpty returns a boolean true if the string’s length is zero. If the string has null it throws NullPointerException Apache StringUtils.isEmpty returns a boolean true if the string is either null or has length is zero Thus its purely dependent on how you are defining “empty string” in your program which will decide which function to use…BTW if you want to skip using Apache Commons funciton and would want to stick to java then you can have your own function like this: public static boolean isEmptyOrNull(String strStringToTest) { return strStringToTest == null || strStringToTest.trim().isEmpty(); }
On Windows: You can download a simple command line tool to do this. You can download the tool from here Usage can be found on the website but pasting it here too for convenience: C:>TarTool.exe Usage : C:>TarTool.exe sourceFile destinationDirectory C:>TarTool.exe D:sample.tar.gz ./ C:>TarTool.exe sample.tgz temp C:>TarTool.exe -x sample.tar temp TarTool 2.0 Beta supports bzip2 decompression for files with extensions like tar.bz2 and .bz2 . TarTool -xj sample.tar.bz2 temp or TarTool -j sample.bz2 Download TarTool 2.0 Beta from here Unpack a .txz file on Windows Use the 7zip tool to unpack a .txz file on windows On Linux: You can use the bzip2 and tar combined to do this… for ex: bzip2 –cd <tar.bz_fileName> | tar –xvf — This will unpack the contents of the tar.bz file Happy Un-Tar-ing