#!/bin/bash
if [1 eq 1] then
#echo "infinite loop"
exit 0
fi
when I run this file I get the following error:
./test_infinite_loop: line 5: syntax error near unexpected token `fi'
./test_infinite_loop: line 5: `fi'
You need to have spaces inside the square brackets; [ is the name of a command so it needs to be a separate token, and it looks for a lone closing ] token.
You need to have spaces inside the square brackets; [ is the name of a command so it needs to be a separate token, and it looks for a lone closing ] token.
Actually you also need a dash before the option -eq.
Anyway, the conventional way to code an endless loop is
Sometimes you see the shell's built in "noop" command, the colon (:), in place of true (which I coincidentally used in the loop's body, before the "nothing" comment).
This is for the big guns...
I have been modifying AudioScope.sh to bring it inline with more current practices.
I hit a bug which IS not present in the original code but was after modification.
Shell check first:-
#!/bin/sh
txt="1234567890"
echo "$(( $txt ))"
echo "$(( ${#txt} - 1 ))"
echo... (17 Replies)
Hi gurus,
I have script as below:
#!/bin/ksh
while :
do
cat /dev/null > srcfile
exit_time=`TZ=GMT-20 date +%Y%m%d1950`
cur_time=`date +%Y%m%d%H%M`
flag=1
if ; then
... (7 Replies)
Hello,
Im using the g++(g++ Ubuntu/Linaro 4.4.4-14ubuntu5 4.4.5) and im trying to compile a small snippet code and got into an endless loop.I recompiled that in VS2010 under Windows 7 and the answer is as expected.so i wonder is this a bug of g++?here is my code.
#include<iostream>
using... (5 Replies)
Hi All,
I am using Red Hat Linux on my servers. The problem that I am facing is, sometimes the /opt usage on the server shows used percentage as 100% , when actually it is simply 20%.
When I reboot the system, it comes back to 20%.Is this a bug in the system or my settings have gone wrong... (1 Reply)
I have been mailing myself logs for a while, but just ran into a problem because of a process that cannot HUP its log. (I realize thats why they implemented the "copytruncate" option in the first place)
When I use logrotate with "copytruncate" and "compress" there is a problem. The "myScript"... (0 Replies)
Discussion started by: jjinno
0 Replies
7. Post Here to Contact Site Administrators and Moderators
When searching for new posts, I see that my voting in one of the polls counts as a 'new post'. However, while the '<blah> minutes ago' entry updates correctly, the 'by <username>' is the last user to actually post a comment in the poll instead.
Result:
Poll: vB Guest Book 39... (4 Replies)
Guys there is another bug that has developed.........now messaged above 6 bytes are trimmed and echoed back to client.After the first message the echo is not regular.I have put a loop in both client and server to check for closing.Moreover for connection close i also need to put another clause that... (3 Replies)