shell for..do done error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell for..do done error
# 1  
Old 04-09-2009
shell for..do done error

#!/bin/bash
if [ $# -lt 4 ]; then
echo "error"

fi


release_name=$3
version=$4


cd $2;

for line in `ls`
do
if [ -d $line ]; then

echo " do ..."
$1 $2/$line $2/$line $release_name $version
fi
done


wats wrong in this ?
'ash: rpmwa.sh: line 16: syntax error near unexpected token `do
'ash: rpmwa.sh: line 16: `do
# 2  
Old 04-09-2009
why don't you use whileinstead of for
for line in `ls`
do


while read line
do
# 3  
Old 04-09-2009
even that 1st if condition is not getting executed

$>>test.sh
: command not found
: command not found
'ash: rpmwa.sh: line 21: syntax error near unexpected token `do
'ash: rpmwa.sh: line 21: `do


here it should print "Error" right?
# 4  
Old 04-09-2009
oops issue solved !!

dos2unix !! :P
sorry
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Syntax error C shell

Hello, I have a newbe syntax error but I cant find it syntax error: unexpected end of file #!/bin/csh # pe request #$ -pe mpi_16 32 #### 16 core : 'mpi_16 16' || 24 core : 'mpi_24 24 ' # our Job name #$ -N test2MD #$ -S /bin/sh (1 Reply)
Discussion started by: dulceC
1 Replies

2. Shell Programming and Scripting

Shell scirpt error

I am not getting 1 for the failure scenario for my below code. any help would be greatly appreciated. If the input is invalid i should get exit. But in the below scenario i am not getting the message exit o. ksh -x client_check.ksh sun + + hostname hn=us + ] + client_check.ksh: test:... (6 Replies)
Discussion started by: arun888
6 Replies

3. Shell Programming and Scripting

Error with using a shell command(looks more generic error)

Hi, This error is actually out of implementing the command posted here - https://www.unix.com/shell-programming-scripting/155589-remove-blank-lines-merge-lines-shell.html Here is the error i get - awk: Input line xxxxx cannot be longer than 3,000 bytes. The source line number is 1.... (1 Reply)
Discussion started by: dvah
1 Replies

4. Shell Programming and Scripting

shell error

Now a days, whenever I am log in to the Unix server, its giving a error saying ${HOME:-.}/.profile: /home/kdas2/inst_swtch: not found mnand504@hcsdev02:$ORACLE_SID:pts/0:$PWD \296> Not a single Unix command is working, even I am not able to edit my .profile using vi editor. can anyone... (3 Replies)
Discussion started by: mady135
3 Replies

5. Shell Programming and Scripting

Error in Shell script

Hello All, I am newbe to scripting and have just taken over following script from previous developer. I am getting following error when running the script. line 70: syntax error near unexpected token `do Could some help me to rectify the error please. Thanks in advance for your... (9 Replies)
Discussion started by: Pahadia
9 Replies

6. Shell Programming and Scripting

01.30 Invalid shell error

Hi, I am getting the error 01.30 Invalid shell error I am running the bash shell script in the korn login shell. I have mentioned the #!/bin/bash statement in the my script but not sure why it is giving this error to me.. (4 Replies)
Discussion started by: mr_harish80
4 Replies

7. Solaris

no shell error

i cannot login as a user then it shows a error. su: no shell i created a new user also. same error . cannot login user i changed shell also please help me urgently (6 Replies)
Discussion started by: sijocg
6 Replies

8. Shell Programming and Scripting

shell error

Can someone please correct this #!/bin/ksh export CURR_TS=`date +"%Y-%m-%d-%H.%M.%S"` i=1 touch ./alldbgroups_${CURR_TS}.dat touch ./alldbusers_${CURR_TS}.dat while i<4 do echo "Now processing test{$i}" >> alldbgroups_${CURR_TS}.dat echo "Now processing test{$i}" >>... (2 Replies)
Discussion started by: pinnacle
2 Replies

9. 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

10. OS X (Apple)

Error when trying to use PHP shell.

Hi, Now that I'm going to be using my Mac as a web host, I decided to use the PHP shell. However, when I type php straight in the terminal, the session freezes. Is there anything wrong that I'm doing? (3 Replies)
Discussion started by: Danny_10
3 Replies
Login or Register to Ask a Question