Syntax Error Problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Syntax Error Problem
# 1  
Old 03-18-2016
Syntax Error Problem

Hi

Below script is throwing an error:

Code:
repos=root
filename=/home/admin/Desktop/authz
case $repos in
root)
    root_folder="\[\/\]"
do

sed "/$root_folder/a $username = $access" $filename

done
;;
esac
exit 0

Error:
Code:
./new1.sh: line 77: syntax error near unexpected token `do'
./new1.sh: line 77: `do'

Can someone please help?

THanks
# 2  
Old 03-18-2016
do ...; done is used in for and while loops and has nothing to do with case statements.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash syntax problem

Hello! i try to understand the art of bash scripting but unfortunately, more i try and less i understand it. Can someone tell me how i can learn its logic? i will give you an example why its making me crazy. Look at this basic script: my for loops are working like this, but it took me more than... (10 Replies)
Discussion started by: sablista
10 Replies

2. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies

3. Shell Programming and Scripting

Problem with if-else syntax

I'm calling the following if-else from nawk. But I keep getting an error at the "else". I've tried putting more brackets and ; but still I get complaints about the "else". Any ideas ? Thanks, wbrunc BEGIN { FS = "," ; OFS = "," } { if ( $8 ~ /A/ && $9 == B ) $1="4/29/2013" ; $2="J.Doe"... (2 Replies)
Discussion started by: wbrunc
2 Replies

4. Shell Programming and Scripting

Problem with syntax error on line 1, teletype

Hi All, I am getting below error message while executing memory utilization script. $ ./mem1.sh syntax error on line 1, teletype syntax error on line 1, teletype $ $ uname -a SunOS 5.9 XXX Generic_122300-60 sun4u sparc SUNW,Sun-Fire-V440 $ But i can execute same script in... (3 Replies)
Discussion started by: susindram
3 Replies

5. Shell Programming and Scripting

Help with awk syntax error problem asking

Input file: 703 1192 720 1162 316 380 1810 439 1969 874 Desired output file: 3 3 awk code that I tried: (1 Reply)
Discussion started by: perl_beginner
1 Replies

6. Shell Programming and Scripting

Problem with syntax using awk

Hi Guys, When below code is executed in script, I get desired output in output file. awk 'NR >= $start_line && NR <= 3' master_scriptlist.txt > $driver1/scriptlist.txtBut when i replace 3 with a variable end_line=3, I do not get ouput. See code below. Is there any problem with syntax awk... (6 Replies)
Discussion started by: ajincoep
6 Replies

7. Shell Programming and Scripting

syntax problem grepping?

I am calculating a time and appending a space in front of it to get only certain records in a file because the times are represented in HH:II:SS format and I don't want to see anything other than the actual hour and minute combination (hence appending the space to the front of the time). My... (9 Replies)
Discussion started by: dsimpg1
9 Replies

8. Shell Programming and Scripting

syntax problem

Dear friends, I am writing shell script in csh . i want to make arthimatic operation in csh. i wrote sysntax like this. set val = 230 set tmp = `0.1 * $val + 300` echo $tmp but it is not working . anyone please give me syntax. (3 Replies)
Discussion started by: rajan_ka1
3 Replies

9. Shell Programming and Scripting

syntax problem

dear friends, I have a large size file containg two fields data like this *** **** 122 222 ***** ***** ***** ***** 232 233 i have file like this. i want to remove blank lines from file . i think awk is servive this problem i wrote a awk command but the error is... (3 Replies)
Discussion started by: rajan_ka1
3 Replies

10. Shell Programming and Scripting

problem with script and syntax error message

Hi I have the following script and have problem debugging the problems. The function of this script is to make sure the entire file is being received (the filesize of a data is not changing after 20 seconds) and start moving the file to another directory. This script should be started every 30mins.... (5 Replies)
Discussion started by: ReV
5 Replies
Login or Register to Ask a Question