2011-04-28 06:35:20     Shell script failure

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-04-28 06:35:20     Shell script failure

Shyam sundar (INDIA)

Message: 100246   

 

Hello world,

 

I tried to run a shell script which does a ftp of a file, but I got error.

 

Below is the error. When I ran the same script in the PC it worked fine.

 

root:/> sh -v /etc/config/ftp_scp.sh

#!/bin/sh

SRC_PATH=/root/.ssh/id_rsa1.pub

DST_PATH=/root/.ssh/authorized_keys

SCP_FILE="/etc/config/ftp_scp_info"

DATA_SEP=":"

if [ -e "$SRC_PATH" ]

then

        exit

fi

while read line

do

        USER=$(syntax error

 

 

The following is the shell script I am trying to run.

 

#!/bin/sh

SRC_PATH=/root/.ssh/id_rsa1.pub

DST_PATH=/root/.ssh/authorized_keys

SCP_FILE="/etc/config/ftp_scp_info"

DATA_SEP=":"

if [ -e "$SRC_PATH" ]

then

    exit

fi

while read line

do

    USER=$(echo $line|cut -d$DATA_SEP -f1)

    PASSWD=$(echo $line|cut -d$DATA_SEP -f2)

    HOST=$(echo $line|cut -d$DATA_SEP -f3)

    echo "\nConnecting $HOST......\nUSERNAME: $USER \nPASSWORD: $PASSWD\n"

done < $SCP_FILE

FILE_NAME="$SRC_PATH $DST_PATH"

ftp -nv <<EOF

open $HOST

user $USER $PASSWD

bin

get $FILE_NAME

close

quit

EOF

exit 2

 

The following is the content of the ftp_scp_info file

 

root:abcd:x.x.x.x

QuoteReplyEditDelete

 

 

2011-04-28 06:40:08     Re: Shell script failure

Mike Frysinger (UNITED STATES)

Message: 100250   

 

-v isnt a valid option

QuoteReplyEditDelete

 

 

2011-04-28 06:52:15     Re: Shell script failure

Shyam sundar (INDIA)

Message: 100253   

 

Hi Mike,

 

-v verbose       The shell writes its input to standard error as it is read.  Useful for debugging.

 

This is what the manual says. Even if I dont give -v option, I do get the syntax error

 

QuoteReplyEditDelete

 

 

2011-04-28 07:11:31     Re: Shell script failure

Mike Frysinger (UNITED STATES)

Message: 100255   

 

you arent reading the manual for the shell that is running on the Blackfin system

 

your output does not show any syntax error

QuoteReplyEditDelete

 

 

2011-04-28 07:35:43     Re: Shell script failure

Shyam sundar (INDIA)

Message: 100256   

 

Hello Mike,

 

I do get the message syntax error

 

root:/> sh -v /etc/config/ftp_scp.sh

#!/bin/sh

SRC_PATH=/root/.ssh/id_rsa1.pub

DST_PATH=/root/.ssh/authorized_keys

SCP_FILE="/etc/config/ftp_scp_info"

DATA_SEP=":"

if [ -e "$SRC_PATH" ]

then

        exit

fi

while read line

do

        USER=$(syntax error

root:/>

root:/>

root:/>

root:/>

root:/>

root:/> sh /etc/config/ftp_scp.sh

syntax error

root:/>

QuoteReplyEditDelete

 

 

2011-04-28 07:44:33     Re: Shell script failure

Mike Frysinger (UNITED STATES)

Message: 100257   

 

your script runs fine for me.  you didnt say what version of software you're using, so i'm guessing it's an old one.

QuoteReplyEditDelete

 

 

2011-04-28 07:58:05     Re: Shell script failure

Shyam sundar (INDIA)

Message: 100258   

 

I am using Linux version 2.6.28.10-ADI-2009R1.1-svn9124 and this what the busybox display

 

BusyBox v1.13.4 (2011-04-28 09:57:16 IST) built-in shell (msh)

 

Should I upgrade Busybox?

QuoteReplyEditDelete

 

 

2011-04-28 08:04:37     Re: Shell script failure

Mike Frysinger (UNITED STATES)

Message: 100259   

 

as you've been informed many times, you should be upgrading to the 2010R1 release.  backporting code from newer releases is not supported.

QuoteReplyEditDelete

 

 

2011-04-28 08:50:30     Re: Shell script failure

Shyam sundar (INDIA)

Message: 100261   

 

Oh,Ok!

 

Thanks Mike !

 

Can I use the same toolchain for 2010 which I used for compiling 2009 version?

 

I will be updating from 2009 to 2010 present in the branch !

QuoteReplyEditDelete

 

 

2011-04-28 08:54:17     Re: Shell script failure

Mike Frysinger (UNITED STATES)

Message: 100262   

 

versions must be the same.  please read the FAQ (Why do I need to use the same version of toolchain/kernel/uClibc/U-boot/uClinux-dist?):

  docs.blackfin.uclinux.org/doku.php?id=faq

QuoteReplyEditDelete

 

 

2011-04-28 15:49:58     Re: Shell script failure

Steve Strobel (UNITED STATES)

Message: 100270   

FWIW, we are using Linux release 2.6.28.10-ADI-2009R1.1 but upgraded BusyBox a couple of months ago in order to use the hush shell.  It couldn't have been much easier.  My notes from doing it follow:

 

    Putting it in a directory parallel to our existing version.

 

stevestrobel@dev-server:~/Blackfin/uClinux/user/busybox$ svn export svn://sources.blackfin.uclinux.org/svn/uclinux-dist/trunk/user/busybox/busybox-1.18.3 busybox-1.18.3

 

    Changing the Makefile to point to that version.

    Now when run "make menuconfig" and find Busybox shells, it says, "msh (deprecated: aliased to hush)". One of the options is "CONFIG_USER_BUSYBOX_HUSH_FUNCTIONS: Enable support for shell functions in hush. +800 bytes." Another option: "CONFIG_USER_BUSYBOX_HUSH_MODE_X: This instructs hush to print commands before execution. Adds ~300 bytes."

    It appeared to build OK.

    The prompt is "~ #". I could live with that, but I would like to change it back. That is the only thing I can see that isn't better.

        This "fixes" the prompt:

        

        /mnt/permanent/scripts # export PS1="\\u:\\w\> "

        root:/mnt/permanent/scripts>

 

    Doing that in /etc/profile (by editing uClinux/vendors/AnalogDevices/IP_RADIO/profile).

 

Steve

Attachments

    Outcomes