Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me fix these shell script errors Source code: #!/bin/bash prime_1=0 echo -n Enter the value of n: read n echo -n First
Please help me fix these shell script errors
Source code:
#!/bin/bash prime_1=0 echo -n "Enter the value of n: " read n echo -n "First $n prime numbers are: " echo -n "2 " counter=1 for((i=3;$counter
done echo ""
Error screen:
./prime.sh line 10: (expr $i + 1: syntax error invalid arithmetic operator (error token is "$i+ 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]' ./prime.sh line 10: (expr $i +1: syntax erro invalid arithmetic operator (error token is "$i 1") ./prime . sh: line 20: [: missing ]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started