C shell integer tests, less than and more than, not working as desired
Hello, I am creating a script that gives me system load info when i start a shell or log in via ssh(in the /etc/profile.d/ folder).
I created it successfully for bash and want it to work with c-shell as well.
This is where i'm having problems, the integer test in the if sentence does not work as it does with bash.
This is the script:
The problem must be in this part: if ( "$cu" > "20" ) then
When i run this, it seems to run fine, but i get the comment: You do not have much cpu capacity available, keep an eye on your memory levels.
This is when i have like 80% free cpu.
I figured it might be because it thinks $cu is a string, but shouldn't i get an error msg if that was the case?
So can you guys help me figure out why this test is not working?
And if you've got any ideas to make this script a bit more simple, i'm open for suggestions. If you need any more info or want to se the bash script, just tell me and i'll post it.
What i find strange is that the logic seems to work fine in my bash version of this script
It's got a different syntax but it's pretty much the same.
About the logic; I think the first line really was supposed to be
i fooled around with it when it did not work. I just can't understand how it can end up echoing this line:
When $cu clearly is at more than 20. Shouldn't it just skip the whole if sentence and go to the next else if?(yes this happens after changing to < instead of > )
I'm gonna try to build the logic like you suggested and see if that gives a better result
Hi,
I had generated a report in my tool as followsoutput.txt
43.35
9
i needed the script to generate a new file like below
i want to append the text to each of these lines of my filenewoutputfile.txt should be
Total Amount : 43.35
Record Count:9
Regards,
Vasa Saikumar.
... (2 Replies)
Hi,
I have created a cron job on IBM AIX but it is not working in desired manner !
Here are the steps which I have followed :-
#!/bin/ksh
#------------------------------------------------------------------
find /some/file/at/the/user/side/test.log -exec cp {}... (8 Replies)
Hello all,
I am trying to write a post-commit hook script using bash script. What I am trying to do here is:
Developers check in their files to a branch. I check the repository and based on the commit I email QA people.
QA verifies and moves the files to a prod branch and email is sent... (1 Reply)
I am scripting in tcsh and here is what I currently have:
foreach group (g1 g2 g3 g4)
set ppl = `cat $group.file.with.list.of.ppl.in.row.format`
set label = 1
@ label += 1
foreach ppls ($ppl)
echo $label >> file
end
end
... (0 Replies)
my file had permission
-rw-rw-r--
I did chmod +rwx, expecting everything to now be rwx, but it is
-rwxrwxr-x
why doesn't o have x permission?
thanks. (2 Replies)
hi all,
i will have a shell scripting exam by thursday and i need a solved exams to get ready for my exam.that is very important for me.i really appreciate your help. (0 Replies)
Hi,
I am about to take certification for "Unix Korn Shell Scripting", which is conducted by brain bench. ( http://www.brainbench.com/xml/bb/common/testcenter/taketest.xml?testId=46)
The test consists of 40 single and multiple choice questions that must be answered in 60 minutes. The pass mark... (0 Replies)
Reborg,
Sorry to bother you. I have tried the code you suggested and it's not creating new files after they satisfy the criteria. If any of the files don't satisfy the criteria it should not create the files at all. Please see my output below. (39 Replies)
Hello..
I have a file containg as below:
My need is to sum the values...
but the error is showing as interger conversion..so i put int() but again not working..please help..here is my code
Thanks in advance
esham (7 Replies)