Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm new to Scripting and I'm trying to validate several of the network tunable variable to see if it matches our correct setting and then pass or fail the test script.The command I can run from command line is :
no -a |grep tcp_ndebug
which returns
tcp_ndebug = 100
the value in this case is correct and the test would pass.
ANy direction in this would be greatly appreciated. I do know these values are found in a file, and I've been experimenting with pulling it from the file and comparing it, but was hoping a script could do it quicker and more efficient.

I am assuming that executing
no -a |grep tcp_ndebug
actually returns
tcp_ndebug = 100
In as script, use command substitution to return the results to a variable:
# I am using the Korn shell, ksh
var=$(no -a |grep tcp_ndebug)# the set command parses your string into command line arguments:using the equal sign
# IFS is the field seperator
set - $(IFS="="; echo ${var})# the second field now contains 100.
# do a check with an if statement: if [[ $2 -eq 100 ]] then echo "it passes" else echo "No, it does NOT pass" fiLet me know if you have any questions

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |