Results 1 to 2 of 2
Hello all,
I am new to linux bash shell scripting.
I am trying to execute the following script on my linux box, but getting error.
Can anyone please help me ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-21-2010 #1Just Joined!
- Join Date
- Oct 2010
- Posts
- 1
Bash shell script error
Hello all,
I am new to linux bash shell scripting.
I am trying to execute the following script on my linux box, but getting error.
Can anyone please help me to get out of it....?
Functionality : I have one search tool CCSearchX, whenever I execute the toll it generates some files. So here here first I am checking whether the same process is in execution or not, if yes then do nothing and if no then check whether any previous result file is available or not. if result file is available then do nothing and if result file is not available execute the CCSearchX utility.
following is the shell script
#!/bin/bash
pgrep -f "CCSearchX"
status=$?
if [ $status != 0 -a $status != 1 -a $status != "" ];
then
echo "Process is running"
else
cd /tmp
if [ "$(find -name 'linux_result_cc_search_*')" != "" ];
then
echo "Output file linux_result_cc_search_* exist."
else
./CCSearchX --input=/ --output=/tmp/linux_result_cc_search_1287659590.txt
fi
fi
And I am getting following error
bash_cc_search_1287659890.sh: line 16: syntax error: unexpected end of fileLast edited by ecomwebtester; 10-21-2010 at 11:51 AM. Reason: forgot to add some code #!/bin/bash
- 10-21-2010 #2Linux Newbie
- Join Date
- Apr 2010
- Location
- Novosibirsk, Russia
- Posts
- 136
I suppose it fails because of wrong usage of nested if-else-if. Try this Nested if/then Condition Tests


Reply With Quote
