I am receiving an error with my Cron job. The error I keep getting is:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
Here is my code:
mysqldump -u database_user -p']T%zw51' database > /home/site/public_html/Secure/Cron/Database_Backup/database_backup.sql
You may need to escape the % with a \.
% is a special character to the crontab, which gets translated to a newline, so your code was probably becoming
-p']T
zw51'
Try:
-p']T\%zw51'
Related
I'm not sure why that error is coming.
Bash Script:
while read line do
grep "^$line$" sort-test1.txt >>matches.txt
done < sort-test2.txt
Error:
syntax error at line 5: `done' unexpected
Please tell me why this error is occuring.
If you wanted to obtain the lines in common in 2 text files. You can execute a simple shell command:
grep -F -x -f sort-test1.txt sort-test2.txt > matches.txt
I think that it is what you need.
run_cmd="spark-submit \
$SPARK_OPTIONS \
--conf spark.hadoop.fs.default.name=file:/// \
--conf spark.hadoop.fs.defaultFS=file:/// \
--py-files \
${TARGET}/test.zip \
$TEST_PY \
$RAW_DATA_FILE \
$OUTPUT \
--route $AGG_OUTPUT1 \
--origin $AGG_OUTPUT2 \
--first $AGG_OUTPUT3" #line 71
echo $run_cmd
echo $run_cmd | bash
#line 75
The code is like above, it can run successfully on Ubuntu. However, when I run it on my macbook, the spark-submit finishes normally and output is also generated correctly, but then it outputs an error, it really sounds unreasonable. Also, if spark-submit exited abnormally, it won't trigger this error.
./test.sh: line 71: unexpected EOF while looking for matching `"'
./test.sh: line 75: syntax error: unexpected end of file
You haven't posted all the relevant code, only some lines near 60~75.
The error you are getting happens when you have an unclosed " somewhere before the posted code. For example:
a="
b="something"
If you run this script with bash, it will report:
script.sh: line 3: unexpected EOF while looking for matching `"'
script.sh: line 4: syntax error: unexpected end of file
As in your case, the error is reported not on the line that didn't close the ",
but somewhere else.
What happens, Bash interprets the value of a as \n\nb=,
and then there is an opening " after something that's never closed.
The same thing is happening in your code.
Look for a " that isn't properly closed earlier in your script.
I have very small shell script.When I am running it run flow. it is giving "syntax error near unexpected token `(". Very basic question but sorry not able to figure out.
foreach i ( `cat list407`)
mkdir cells/${i}
cp /<path>/$i/${i}.gds cells/${i}/${i}.gds
end
Error:
flow: line 1: syntax error near unexpected token `('
flow: line 1: `foreach i ( `cat list407`)'
You've used csh syntax for execution using bash which is causing the error.
Either use csh to execute your script, or using bash say:
while read -r i; do
mkdir "cells/${i}"
cp "/<path>/${i}/${i}.gds" "cells/${i}/${i}.gds"
done < list407
for i in $(cat list407); do
mkdir cells/${i};
cp /<path>/$i/${i}.gds cells/${i}/${i}.gds;
done
If there some difference between the bash of Mac OS and other linuxs'?
I wrote a simple bash script named "test.sh" like this:
#!/bin/bash
MYVAR=abc
if [ $MYVAR = abc ]; then
echo "ok"
fi
When I run it in terminal, some error occurs:
./test.sh: line 3: syntax error near unexpected token `then'
./test.sh: line 3: `if[ $MYVAR = abc ]; then'
then I delete the character ";" before "then" and run the script again, some infos occurs:
./test.sh: line 3: if[ abc = abc ]: command not found
ok
./test.sh: line 5: syntax error near unexpected token `fi'
./test.sh: line 5: `fi'
Could someone tell me what's wrong with my script?
Consider putting spaces into your file the way you put it in your example (if [).
[ is a command (same as test). It must be separated by spaces on both sides.
I'd really love to have steps auto completion in TextMate, but when having my cursor somewhere in a step and pressing Opt-Esc, it results in the following:
/Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:87:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of filemap!'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:81:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of filespecs'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:137:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of filerequested_specs'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/environment.rb:23:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of filesetup'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler.rb:100:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 3: syntax error: unexpected end of filerequire'
from /Users/josh/Library/Application Support/TextMate/Pristine Copy/Bundles/Cucumber.tmbundle/Support/lib/cucumber/mate/feature_helper.rb:1
from /tmp/temp_textmate.gE2STt:3:in
Anyone got this working? I'm on Ruby 1.9.3-p0 and the newest versions of Rails and Cucumber.