script error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script error
# 1  
Old 06-25-2008
script error

hello i got server quad core with linux CentOS
i want to install script (this is a part of the script)

PHP Code:
#!/bin/bash

IPconfig=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | cut -d\  -f1`;
IPon="$IPconfig";

id grep "uid=0(" >/dev/null
if [ $? != "0" ]; then
        uname 
-grep -i CYGWIN >/dev/null
        
if [ $? != "0" ]; then
             printf 
"You must be Root to do this!"
               
su > /dev/null
                
        fi
fi

id 
grep "uid=0(" >/dev/null
if [ $? != "0" ]; then
        uname 
-grep -i CYGWIN >/dev/null
        
if [ $? != "0" ]; then
          
echo "Wrong Root Password, Try Again!"
           
           
./Install.sh
         
exit 1
              
        fi
fi

#adduser rpanel > /dev/null 2> /dev/null

echo "Welcome To Install!"
/usr/sbin/adduser rpanel > /dev/null 2> /dev/null
printf 
"Loading Setup"
sleep 1
printf 
"."
sleep 1
printf 
"."
sleep 1
printf 
"."
echo ""
if cd RPanel 2> /dev/null
then
echo ""
cd RPanel 2> /dev/null
cd 
..
else

echo 
"Error: Missing Files, Cannot Start Install."
printf "Exiting"
sleep 1
printf 
"."
sleep 1
printf 
"."
sleep 1
printf 
"."
echo ""
exit 0
exit 1

fi


if cd vRPanel 2> /dev/null
then
cd vRPanel 2
> /dev/null

tar 
-zxvf RPanel-Files.tar.gz 
chmod 777 
*
cd ..
chmod 777 vRPanel -R
else
echo 
"Error: Missing Files, Cannot Start Install."
echo "Exiting"
sleep 1
printf 
"."
sleep 1
printf 
"."
sleep 1
printf 
"."
echo ""
exit 1

fi

if cd commands 2> /dev/null
then
cd commands 2
> /dev/null
cd 
..
else
echo 
"Error: Missing Files, Cannot Start Install."
printf "Exiting"
sleep 1
printf 
"."
sleep 1
printf 
"."
sleep 1
printf 
"."
echo ""
exit 0
exit 1

fi
printf 
"Setuping RPanel IP Config"
sleep 1
printf 
"."
sleep 1
printf 
"."
sleep 1
printf 
"."
echo ""

for ((i=1;$i<=3;i=$i+1))
{
printf "Enter Your IP (Default: $IPconfig): "
read ipcon
if [ "$ipcon!= "" ]; then
IPconfig
="$ipcon"
fi


printf 
"Is $IPconfig the IP that you chose? (yes,no): "
read yesno

if [ "$yesno"yes" ]; then

i
=10

fi

if [ "$yesno"no" ]; then

i
=1
IPconfig
="$IPon";
exit

fi

if [ "$yesno"" ]; then

i
=1
IPconfig
="$IPon";

fi


when im doing "sh Install.sh" through the ROOT
it writes me :
PHP Code:
command not found:
command not found:
command not found:
'nstall.sh: line : syntax error near unexpected token `
'
nstall.shline : `for ((i=1;i<=3;i=i+1)) 
whats the problem here?!

thanks Smilie
# 2  
Old 06-25-2008
Quote:
Originally Posted by xipiska
PHP Code:
#!/bin/bash

<snip>

for ((
i=1;$i<=3;i=$i+1))
{
<
snip>

when im doing "sh Install.sh" through the ROOT
it writes me :
PHP Code:
command not found:
command not found:
command not found:
'nstall.sh: line : syntax error near unexpected token `
'
nstall.shline : `for ((i=1;i<=3;i=i+1)) 
whats the problem here?!

thanks Smilie
The numeric "for" loop is bash shell syntax that is not available in the Bourne shell. You have a bash shell script. To execute it make it executable (with "chmod +x Install.sh") and then run it (with ./Install.sh).

There is no need to use the "sh" command to run this script.

If you don't want to make the script executable for some reason you can use the "bash" command to run it (with "bash Install.sh").
# 3  
Old 06-25-2008
ive tried to do that
it writes me :
PHP Code:
[root@root RPSetup]# ./Install.sh
bash: ./Install.sh: /bin/bash^Mbad interpreterNo such file or directory 
# 4  
Old 06-26-2008
Quote:
Originally Posted by xipiska
ive tried to do that
it writes me :
PHP Code:
[root@root RPSetup]# ./Install.sh
bash: ./Install.sh: /bin/bash^Mbad interpreterNo such file or directory 
This means you do not have a file called bash in the directory /bin.

Do you have bash on your system?

Actually, the ^M suggests that the file has passed through a windoze system at some point.

Run it through dos2unix to remove those carriage returns, or use the vi command :%s/^V^M

Last edited by risby; 06-26-2008 at 07:51 AM.. Reason: missed the ^M
# 5  
Old 06-26-2008
i dont understand what to do now..please explain
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script with sql script error

Hi All when I execute from psql prompt, I get the result, when I try to automate using a shell script, the query is not working # `/usr/bin/psql -U postgres -d coba1 -c "select name from users where "Date" > current_date - 30;"` ERROR: column "Date" does not exist LINE 1: select... (2 Replies)
Discussion started by: srilinux09
2 Replies

2. Shell Programming and Scripting

Calling shell script within awk script throws error

I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks sh: -c: line 0: syntax error near unexpected token `newline' sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies

3. Shell Programming and Scripting

Help with FTP Script which is causing "syntax error: unexpected end of file" Error

Hi All, Please hav a look at the below peice of script and let me know if there are any syntax errors. i found that the below peice of Script is causing issue. when i use SFTP its working fine, but there is a demand to use FTP only. please find below code and explain if anything is wrong... (1 Reply)
Discussion started by: mahi_mayu069
1 Replies

4. Shell Programming and Scripting

Error in calling a shell script from another script

HI, We are using two shell scripts, script.sh,env.sh, where env.sh will be called inside script.sh. The variable inside env.sh is used as $var in script.sh.But while running the script its not identifying that variable. Is there any permission needed to call a script inside another script. ... (3 Replies)
Discussion started by: banupriyat
3 Replies

5. UNIX for Dummies Questions & Answers

Re: Script Error [syntax error at line]

Hi , I Have Written A Simple Script To Check Greatest Of '2' Number When Execuating The Script I Am Getting The Below Error SP11: if:not found SP11: line 4:syntax error at line 5:'then' unexpexted And The Program I Have Wrriten For This #!bin/ksh echo "Enter Two Numbers"... (3 Replies)
Discussion started by: anudeepkumar123
3 Replies

6. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

7. Shell Programming and Scripting

How to grep sql error in shell script and exit the script?

I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts. Here is my script #!/bin/csh -f source .orapass set user = $USER set pass = $PASS cd /opt/data/scripts echo... (2 Replies)
Discussion started by: allinshell99
2 Replies

8. Windows & DOS: Issues & Discussions

Error opening script file - location error

Hello, I know nothing about UNIX, ftp, etc. I am building an excel VBA macro which calls a .bat file. I've taken a pre-existing batch file and am trying to modify it to fit my purposes. I would be very grateful for some assistance. Here is my .bat file: echo off set... (9 Replies)
Discussion started by: starcraftbud
9 Replies

9. Shell Programming and Scripting

Script with error output but continuation in script?

I have written a basic fetching script. The script logs into an FTP site, downloads a .zip file, then unzips and moves the files to the necessary folders, then deletes them, etc. The problem I have is if one of the files no longer exists on the FTP site or another part of the script fails, then... (3 Replies)
Discussion started by: daem0n
3 Replies

10. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies
Login or Register to Ask a Question